Я только что купил новую капельку у digitalocean, и я установил nginx с sudo apt install nginx
попробованный, чтобы видеть, работало ли это, и это дало мне после ошибки:
root@school:~# 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 Mon 2019-05-20 19:27:11 UTC; 22s ago
Docs: man:nginx(8)
Process: 21174 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=1/FAILURE)
Process: 21160 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Main PID: 851 (code=exited, status=0/SUCCESS)
May 20 19:27:10 school nginx[21174]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
May 20 19:27:10 school nginx[21174]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
May 20 19:27:10 school nginx[21174]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
May 20 19:27:10 school nginx[21174]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
May 20 19:27:11 school nginx[21174]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
May 20 19:27:11 school nginx[21174]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
May 20 19:27:11 school nginx[21174]: nginx: [emerg] still could not bind()
May 20 19:27:11 school systemd[1]: nginx.service: Control process exited, code=exited status=1
May 20 19:27:11 school systemd[1]: nginx.service: Failed with result 'exit-code'.
May 20 19:27:11 school systemd[1]: Failed to start A high performance web server and a reverse proxy server.
Это - мои настройки брандмауэра:
To Action From
-- ------ ----
80/tcp ALLOW Anywhere
22 ALLOW Anywhere
3306 ALLOW Anywhere
Apache ALLOW Anywhere
Nginx HTTP ALLOW Anywhere
Nginx HTTPS ALLOW Anywhere
80/tcp (v6) ALLOW Anywhere (v6)
22 (v6) ALLOW Anywhere (v6)
3306 (v6) ALLOW Anywhere (v6)
Apache (v6) ALLOW Anywhere (v6)
Nginx HTTP (v6) ALLOW Anywhere (v6)
Nginx HTTPS (v6) ALLOW Anywhere (v6)
Это ясно какому-либо из Вас, какова проблема? Спасибо за внимание
sudo netstat -tlpn | grep :80
дал следующие результаты:
root@school:~# sudo netstat -tlpn | grep :80
tcp6 0 0 :::80 :::* LISTEN 16792/apache2
Результаты sudo netstat -tlpn | grep :80
показывают, что у вас запущен Apache. Два процесса не могут одновременно прослушивать один и тот же сокет, поэтому nginx не может запуститься.
Вы можете остановить Apache с помощью sudo systemctl stop apache2
, а если хотите, отключите его с помощью sudo systemctl disable apache2
. Последняя команда навсегда отключит автоматический запуск Apache.
Если вы хотите удалить Apache, запустите sudo apt remove apache2 apache2-data apache2-utils
.