Open1
Nginx起動エラー
% 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 Mon 2024-03-04 17:29:30 UTC; 14s ago
Docs: man:nginx(8)
Process: 26473 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Process: 26474 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=1/FAILURE)
CPU: 30ms
Mar 04 17:29:29 dev-tagami nginx[26474]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Unknown error)
Mar 04 17:29:29 dev-tagami nginx[26474]: nginx: [emerg] bind() to [::]:80 failed (98: Unknown error)
Mar 04 17:29:29 dev-tagami nginx[26474]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Unknown error)
Mar 04 17:29:29 dev-tagami nginx[26474]: nginx: [emerg] bind() to [::]:80 failed (98: Unknown error)
Mar 04 17:29:30 dev-tagami nginx[26474]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Unknown error)
Mar 04 17:29:30 dev-tagami nginx[26474]: nginx: [emerg] bind() to [::]:80 failed (98: Unknown error)
Mar 04 17:29:30 dev-tagami nginx[26474]: nginx: [emerg] still could not bind()
Mar 04 17:29:30 dev-tagami systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
Mar 04 17:29:30 dev-tagami systemd[1]: nginx.service: Failed with result 'exit-code'.
Mar 04 17:29:30 dev-tagami systemd[1]: Failed to start A high performance web server and a reverse proxy server.
バインドのエラーが出ている
ポート80がappache2で既に使われているため競合している
% apt list --installed | grep appachce
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
%sudo lsof -i :80
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
apache2 767 root 4u IPv6 19823 0t0 TCP *:http (LISTEN)
apache2 14290 www-data 4u IPv6 19823 0t0 TCP *:http (LISTEN)
apache2 14291 www-data 4u IPv6 19823 0t0 TCP *:http (LISTEN)
apache2 14292 www-data 4u IPv6 19823 0t0 TCP *:http (LISTEN)
apache2 14293 www-data 4u IPv6 19823 0t0 TCP *:http (LISTEN)
apache2 14294 www-data 4u IPv6 19823 0t0 TCP *:http (LISTEN)
apache2サービスの無効化
sudo systemctl disable apache2
現在実行中のapache2サービスの停止
sudo systemctl stop apache2
nginx起動
% sudo systemctl restart 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: active (running) since Mon 2024-03-04 17:41:28 UTC; 10s ago
Docs: man:nginx(8)
Process: 26694 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Process: 26695 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Main PID: 26696 (nginx)
Tasks: 3 (limit: 2275)
Memory: 3.9M
CPU: 36ms
CGroup: /system.slice/nginx.service
├─26696 "nginx: master process /usr/sbin/nginx -g daemon on; master_process on;"
├─26697 "nginx: worker process" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
└─26698 "nginx: worker process" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
Mar 04 17:41:28 dev-tagami systemd[1]: Starting A high performance web server and a reverse proxy server...
Mar 04 17:41:28 dev-tagami systemd[1]: Started A high performance web server and a reverse proxy server.