Anna_Repina
@Anna_Repina
Хочу все знать

Почему после установки Rocket.chat не могу установить Nginx?

Всем привет!
После установки Rocketchat на ВМ Ubuntu 22.04 (server) пытались установить nginx, но полетели ошибки, что делаем не так и как решить данную проблему??
Рестарт nginx не помогает.

Ошибки при установке:
spoiler

invoke-rc.d: initscript nginx, action "start" failed.
× 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 2023-06-14 12:10:39 MSK; 4ms ago
Docs: man:nginx(8)
Process: 3451 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)
CPU: 10ms

Jun 14 12:10:39 rocketchat systemd[1]: Starting A high performance web server and a reverse proxy server...
Jun 14 12:10:39 rocketchat nginx[3451]: nginx: [emerg] socket() [::]:80 failed (97: Unknown error)
Jun 14 12:10:39 rocketchat nginx[3451]: nginx: configuration file /etc/nginx/nginx.conf test failed
Jun 14 12:10:39 rocketchat systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
Jun 14 12:10:39 rocketchat systemd[1]: nginx.service: Failed with result 'exit-code'.
Jun 14 12:10:39 rocketchat systemd[1]: Failed to start A high performance web server and a reverse proxy server.
dpkg: error processing package nginx-core (--configure):
installed nginx-core package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of nginx:
nginx depends on nginx-core (<< 1.18.0-6ubuntu14.3.1~) | nginx-full (<< 1.18.0-6ubuntu14.3.1~) | nginx-light (<< 1.18.0-6ubuntu14.3.1~) | nginx-extras (<< 1.18.0-6ubuntu14.3.1~); however:
Package nginx-core is not configured yet.
Package nginx-full is not installed.
Package nginx-light is not installed.
Package nginx-extras is not installed.
nginx depends on nginx-core (>= 1.18.0-6ubuntu14.3) | nginx-full (>= 1.18.0-6ubuntu14.3) | nginx-light (>= 1.18.0-6ubuntu14.3) | nginx-extras (>= 1.18.0-6ubuntu14.3); however:
Package nginx-core is not configured yet.
Package nginx-full is not installed.
Package nginx-light is not installed.
Package nginx-extras is not installed.

dpkg: error processing package nginx (--configure):
dependency problems - leaving unconfigured
Processing triggers for libc-bin (2.35-0ubuntu3.1) ...
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
nginx-core
nginx
needrestart is being skipped since dpkg has failed
E: Sub-process /usr/bin/dpkg returned an error code (1)


Записи в журнале выдают следующее:
spoiler

root@rocketchat:/home/user# journalctl -xeu nginx.service
Jun 14 12:10:39 rocketchat systemd[1]: Starting A high performance web server and a reverse proxy server...
░░ Subject: A start job for unit nginx.service has begun execution
░░ Defined-By: systemd
░░ Support: www.ubuntu.com/support
░░
░░ A start job for unit nginx.service has begun execution.
░░
░░ The job identifier is 1575.
Jun 14 12:10:39 rocketchat nginx[3374]: nginx: [emerg] socket() [::]:80 failed (97: Unknown error)
Jun 14 12:10:39 rocketchat nginx[3374]: nginx: configuration file /etc/nginx/nginx.conf test failed
Jun 14 12:10:39 rocketchat systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ An ExecStartPre= process belonging to unit nginx.service has exited.
░░ The process' exit code is 'exited' and its exit status is 1.
Jun 14 12:10:39 rocketchat systemd[1]: nginx.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ The unit nginx.service has entered the 'failed' state with result 'exit-code'.
Jun 14 12:10:39 rocketchat systemd[1]: Failed to start A high performance web server and a reverse proxy server.
░░ Subject: A start job for unit nginx.service has failed
░░ Defined-By: systemd
░░ A start job for unit nginx.service has finished with a failure.
░░ The job identifier is 1575 and the job result is failed.
Jun 14 12:10:39 rocketchat systemd[1]: Starting A high performance web server and a reverse proxy server...
░░ Subject: A start job for unit nginx.service has begun execution
░░ Defined-By: systemd
░░ A start job for unit nginx.service has begun execution.
░░ The job identifier is 1652.
Jun 14 12:10:39 rocketchat nginx[3451]: nginx: [emerg] socket() [::]:80 failed (97: Unknown error)
Jun 14 12:10:39 rocketchat nginx[3451]: nginx: configuration file /etc/nginx/nginx.conf test failed
Jun 14 12:10:39 rocketchat systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: www.ubuntu.com/support
░░ An ExecStartPre= process belonging to unit nginx.service has exited.
░░ The process' exit code is 'exited' and its exit status is 1.
Jun 14 12:10:39 rocketchat systemd[1]: nginx.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ The unit nginx.service has entered the 'failed' state with result 'exit-code'.
Jun 14 12:10:39 rocketchat systemd[1]: Failed to start A high performance web server and a reverse proxy server.
░░ Subject: A start job for unit nginx.service has failed
░░ Defined-By: systemd
░░ Support: www.ubuntu.com/support
░░
░░ A start job for unit nginx.service has finished with a failure.
░░
░░ The job identifier is 1652 and the job result is failed.
Jun 14 12:14:06 rocketchat systemd[1]: Starting A high performance web server and a reverse proxy server...
░░ Subject: A start job for unit nginx.service has begun execution
░░ Defined-By: systemd
░░ Support: www.ubuntu.com/support
░░
░░ A start job for unit nginx.service has begun execution.
░░
░░ The job identifier is 1729.
Jun 14 12:14:06 rocketchat nginx[3482]: nginx: [emerg] socket() [::]:80 failed (97: Unknown error)
Jun 14 12:14:06 rocketchat nginx[3482]: nginx: configuration file /etc/nginx/nginx.conf test failed
Jun 14 12:14:06 rocketchat systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: www.ubuntu.com/support
░░
░░ An ExecStartPre= process belonging to unit nginx.service has exited.
░░
░░ The process' exit code is 'exited' and its exit status is 1.
Jun 14 12:14:06 rocketchat systemd[1]: nginx.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: www.ubuntu.com/support
░░
░░ The unit nginx.service has entered the 'failed' state with result 'exit-code'.
Jun 14 12:14:06 rocketchat systemd[1]: Failed to start A high performance web server and a reverse proxy server.
░░ Subject: A start job for unit nginx.service has failed
░░ Defined-By: systemd
░░ Support: www.ubuntu.com/support
░░
░░ A start job for unit nginx.service has finished with a failure.
░░
░░ The job identifier is 1729 and the job result is failed.

systemctl status nginx:
spoiler

× 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 2023-06-14 12:14:06 MSK; 1h 10min ago
Docs: man:nginx(8)
Process: 3482 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)
CPU: 7ms

Jun 14 12:14:06 rocketchat systemd[1]: Starting A high performance web server and a reverse proxy server...
Jun 14 12:14:06 rocketchat nginx[3482]: nginx: [emerg] socket() [::]:80 failed (97: Unknown error)
Jun 14 12:14:06 rocketchat nginx[3482]: nginx: configuration file /etc/nginx/nginx.conf test failed
Jun 14 12:14:06 rocketchat systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
Jun 14 12:14:06 rocketchat systemd[1]: nginx.service: Failed with result 'exit-code'.
Jun 14 12:14:06 rocketchat systemd[1]: Failed to start A high performance web server and a reverse proxy server.


cat /etc/nginx/sites-available/default:
spoiler

# Default server configuration
#
server {
listen 80 default_server;
listen [::]:80 default_server;

# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;

root /var/www/html;
server_name _;

location / {
# 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$ {
#server {
# listen 80;
# listen [::]:80;
#
# server_name example.com;
#
# root /var/www/example.com;
# index index.html;
#
# location / {
# try_files $uri $uri/ =404;
# }
#}
  • Вопрос задан
  • 200 просмотров
Пригласить эксперта
Ответы на вопрос 4
SignFinder
@SignFinder
Wintel\Unix Engineer\DevOps
Есть же информация об ошибке "nginx: configuration file /etc/nginx/nginx.conf test failed".
Запустите nginx -t - покажет строку с ошибкой.
Ответ написан
mikes
@mikes
устанавливая рокетчат устанавливается и caddy и висит на портах 80 и 443 которые пытается занять nginx
остановите caddy и nginx при установке отработает штатно
Ответ написан
Комментировать
leahch
@leahch Куратор тега Linux
3D специалист. Dолго, Dорого, Dерьмово.
У Вас невалидная конфигурация nginx, проверьте количество закрывающих и открывающих скобочек фигурных {} в /etc/nginx/sites-available/default
Ну и перед перезапуском nginx -t для проверки.
Ответ написан
@AUser0
Чем больше знаю, тем лучше понимаю, как мало знаю.
У вас уже какой-то сервис занял порт 80, на котором должен работать nginx. Найдите и остановите, а лучше удалите сервис, занимающий 80-й порт. Поможет команда netstat -nltp |grep :80, в конце строки - имя сервиса.
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы