Sto cercando di installare Discourse su un sottodominio.
Il mio dominio principale utilizza WordPress, che è stato creato utilizzando docker-compose.
Il sottodominio e il dominio utilizzano lo stesso server VPS.
Purtroppo, NGIX non si avvia. Quando eseguo il comando systemctl status nginx, appare il seguente messaggio:
× nginx.service - Un server web ad alte prestazioni e un server proxy inverso
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; preset: enabled)
Active: failed (Result: exit-code) since Ven 08/03/2024 07:06:36 CST; 1h 14min fa
Docs: man:nginx(8)
Process: 27329 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Process: 27330 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=1/FAILURE)
CPU: 42ms
08/03/2024 07:06:33 vmi1695712.contaboserver.net systemd[1]: Starting Un server web ad alte prestazioni e un server proxy inverso...
08/03/2024 07:06:33 vmi1695712.contaboserver.net nginx[27330]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Unknown error)
08/03/2024 07:06:34 vmi1695712.contaboserver.net nginx[27330]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Unknown error)
08/03/2024 07:06:34 vmi1695712.contaboserver.net nginx[27330]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Unknown error)
08/03/2024 07:06:35 vmi1695712.contaboserver.net nginx[27330]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Unknown error)
08/03/2024 07:06:35 vmi1695712.contaboserver.net nginx[27330]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Unknown error)
08/03/2024 07:06:36 vmi1695712.contaboserver.net nginx[27330]: nginx: [emerg] still could not bind()
08/03/2024 07:06:36 vmi1695712.contaboserver.net systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
08/03/2024 07:06:36 vmi1695712.contaboserver.net systemd[1]: nginx.service: Failed with result 'exit-code'.
08/03/2024 07:06:36 vmi1695712.contaboserver.net systemd[1]: Failed to start Un server web ad alte prestazioni e un server proxy inverso.
Il mio file di configurazione per Discourse:
# Default server configuration
#
server {
# listen 80 default_server;
# listen [::]:80 default_server;
# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
server_name forum.ictsharks.com;
location / {
proxy_pass http://unix:/var/discourse/shared/standalone/nginx.http.sock:;
proxy_set_header Host $http_host;
proxy_http_version 1.1;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
# try_files $uri $uri/ =404;
}
# pass PHP scripts to FastCGI server
#
#location ~ \.php$ {
# include snippets/fastcgi-php.conf;
#
# # With php-fpm (or other unix sockets):
# fastcgi_pass unix:/run/php/php7.4-fpm.sock;
# # With php-cgi (or other tcp sockets):
# fastcgi_pass 127.0.0.1:9000;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\..ht {
# deny all;
#}
}
L’ho controllato più volte, ma non riesco a capire dov’è l’errore.
Mi dispiace, sono un principiante con Linux / NGINX / Docker. Qualsiasi consiglio sarebbe apprezzato. Grazie.
Istruzioni suggeriscono di commentarli, quindi ho fatto:
## quali porte TCP/IP dovrebbe esporre questo container?
## Se si desidera che Discourse condivida una porta con un altro webserver come Apache o nginx,
## vedere https://meta.discourse.org/t/17247 per i dettagli
esponi:
# - "80:80" # http
# - "443:443" # https
Capisco i record DNS, https e i certificati. Solo il resto è nuovo per me.
Non preoccuparti, so come usare Google e imparo in fretta
Come ho dichiarato, credo che l’altro NGIX (quello per wordpress) funzioni in un container insieme a MySQL e Wordpress.
Questo è ciò che ottengo eseguendo il comando docker ps:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
6ca4cbec2c88 local_discourse/app " /sbin/boot" 51 minutes ago Up 15 minutes app
4a3ebdd9f5b5 nginx:1.15.12-alpine "nginx -g 'daemon of..." 20 hours ago Up 15 minutes 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp webserver
42c4211a2fb6 wordpress:5.1.1-fpm-alpine "docker-entrypoint.s..." 2 days ago Up 15 minutes 9000/tcp wordpress
5b588a7435ad mysql:8.0 "docker-entrypoint.s..." 2 days ago Up 15 minutes 3306/tcp, 33060/tcp db
Ecco perché l’nginx esterno non può avviarsi, poiché le porte sono occupate da quello interno. Probabilmente è necessario arrestare quel container e trasferire la sua configurazione per WordPress allo strato esterno di nginx.
Inoltre, questi sono container separati, nginx è separato da MySQL e WordPress.
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
6ca4cbec2c88 local_discourse/app “/sbin/boot” 3 ore fa Up 2 ore app
42c4211a2fb6 wordpress:5.1.1-fpm-alpine “docker-entrypoint.s…” 2 giorni fa Up 2 ore 9000/tcp wordpress
5b588a7435ad mysql:8.0 “docker-entrypoint.s…” 2 giorni fa Up 2 ore 3306/tcp, 33060/tcp db
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 418/systemd-resolve
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 462/sshd: /usr/sbin
tcp6 0 0 :::22 :::* LISTEN 462/sshd: /usr/sbin
udp 0 0 127.0.0.53:53 0.0.0.0:* 418/systemd-resolve