problema ao iniciar o nginx no Debian9

1

Eu instalei o nginx-full no debian9 e não consigo iniciá-lo. Quando eu fiz.

sudo /etc/init.d/nginx start

Eu tenho

[....] Starting nginx (via systemctl): nginx.serviceJob for nginx.service failed because the control process exited with error code.
See "systemctl status nginx.service" and "journalctl -xe" for details.
failed!

Eu também tentei %código% e tenho

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

a saída para o status do systemctl nginx.service é:

$sudo systemctl status nginx.service

 nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Wed 2018-06-06 15:16:04 IST; 10min ago
     Docs: man:nginx(8)
  Process: 2305 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=1/FAILURE)
  Process: 2302 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
 Main PID: 27844 (code=exited, status=0/SUCCESS)


Jun 06 15:16:02 debedx nginx[2305]: nginx: [emerg] listen() to 0.0.0.0:80, backlog 511 failed (98: Address already in use)
Jun 06 15:16:02 debedx nginx[2305]: nginx: [emerg] listen() to 0.0.0.0:80, backlog 511 failed (98: Address already in use)
Jun 06 15:16:03 debedx nginx[2305]: nginx: [emerg] listen() to 0.0.0.0:80, backlog 511 failed (98: Address already in use)
Jun 06 15:16:03 debedx nginx[2305]: nginx: [emerg] listen() to 0.0.0.0:80, backlog 511 failed (98: Address already in use)
Jun 06 15:16:04 debedx nginx[2305]: nginx: [emerg] listen() to 0.0.0.0:80, backlog 511 failed (98: Address already in use)
Jun 06 15:16:04 debedx nginx[2305]: nginx: [emerg] still could not bind()
Jun 06 15:16:04 debedx systemd[1]: nginx.service: Control process exited, code=exited status=1
Jun 06 15:16:04 debedx systemd[1]: Failed to start A high performance web server and a reverse proxy server.
Jun 06 15:16:04 debedx systemd[1]: nginx.service: Unit entered failed state.
Jun 06 15:16:04 debedx systemd[1]: nginx.service: Failed with result 'exit-code'.
    
por Sonu Sirvee 06.06.2018 / 11:27

1 resposta

0

Olhando para a saída de systemctl status nginx.service , parece que a porta na qual o nginx está sendo executado está sendo usada por outro processo.

Você pode verificar isso usando o comando netstat -tulpn|grep 80 . Uma vez identificado,

(1) Altere a porta no. de nginx no arquivo de configuração editando /etc/nginx/nginx.conf usando um editor e defina 'Listen <new_port_no.>' e inicie nginx ( systemctl start nginx.service ) ou

(2) Elimine esse processo se esse processo não for significativo, emitindo o comando e o início nginx . Para conhecer o ID do processo, digite: ps aux|grep <process name>

kill <process id>

Certifique-se do que você vai fazer antes de matar o processo. Por isso eu sugiro que você mude a porta não. de nginx

    
por 06.06.2018 / 13:33

Tags