0

I run Arch Linux and when I run:

sudo systemctl start nginx.service

I get the following message in the journal:

nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Wed 2019-05-15 11:17:03 BST; 45s ago
  Process: 1542 ExecStart=/usr/bin/nginx -g pid /run/nginx.pid; error_log stderr; (code=exited, status=1/FAILURE)

May 15 11:17:03 systemd[1]: Starting A high performance web server and a reverse proxy server...
May 15 11:17:03 nginx[1542]: 2019/05/15 11:17:03 [emerg] 1542#1542: a duplicate listen 0.0.0.0:80 in /etc/nginx/nginx.conf:42
May 15 11:17:03  systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
May 15 11:17:03  systemd[1]: nginx.service: Failed with result 'exit-code'.
May 15 11:17:03  systemd[1]: Failed to start A high performance web server and a reverse proxy server.

I don't understand the error here. How do I fix this?

UPDATE

● nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Wed 2019-05-15 11:36:36 BST; 9s ago
  Process: 1667 ExecStart=/usr/bin/nginx -g pid /run/nginx.pid; error_log stderr; (code=exited, status=1/FAILURE)

May 15 11:36:36  systemd[1]: Starting A high performance web server and a reverse proxy server...
May 15 11:36:36  nginx[1667]: 2019/05/15 11:36:36 [emerg] 1667#1667: getpwnam("www-data") failed in /etc/nginx/nginx.conf:3
May 15 11:36:36  systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
May 15 11:36:36  systemd[1]: nginx.service: Failed with result 'exit-code'.
May 15 11:36:36  systemd[1]: Failed to start A high performance web server and a reverse proxy server.
  • that grep doesn't return anything – C.S May 15 '19 at 10:27
0

There is something else which listen on port 80, check line:

duplicate listen 0.0.0.0:80

To see which PID listen you can try

netstat -anp|grep :80

If something is wrong with nginx config you can try this minimal one:

daemon            on;
worker_processes  2;
user              www-data;
events {
    use           epoll;
    worker_connections  128;
}
error_log         logs/error.log info;
http {
    server_tokens off;
    include       mime.types;
    charset       utf-8;
    access_log    logs/access.log  combined;
    server {
        server_name   localhost;
        listen        *:80;
        error_page    500 502 503 504  /50x.html;
        location      / {
            root      html;
        }
    }
}
| improve this answer | |
  • I did fuser 80/tcp but it returns nothing – C.S May 15 '19 at 10:28
  • The netstat returns tcp 1 0 192.168.161.43:39038 216.58.198.238:80 CLOSE_WAIT 1766/chromium --typ – C.S May 15 '19 at 10:29
  • I ran the fuser as root but still nothing – C.S May 15 '19 at 10:29
  • I even rebooted my machine – C.S May 15 '19 at 10:30
  • 1
    Something badly went wrong with the installation I think - some stuff was missing Working now – C.S May 15 '19 at 10:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.