1

I'm getting a bit frustrated here. I want port 80 for apache2 but nginx has stolen that port apparently.

I cant find where to remove this, the config for nginx say its listening to port 8000 and 8001

what i can find is that the PID/Program name "6021/nginx -g daemo" uses this as local adress 127.0.0.1:80.

When i do systemctl status nginx this is the info i get the following

    ● 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 Sat 2018-05-05 01:33:40 CEST; 5s ago
  Process: 6110 ExecStop=/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid (code=exited, status=0/SUCCESS)
  Process: 6118 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
  Process: 6113 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
 Main PID: 6120 (nginx)
    Tasks: 17
   Memory: 8.9M
      CPU: 46ms
   CGroup: /system.slice/nginx.service
           ├─6120 nginx: master process /usr/sbin/nginx -g daemon on; master_process on
           ├─6121 nginx: worker process
           ├─6122 nginx: worker process
           ├─6123 nginx: worker process
           ├─6124 nginx: worker process
           ├─6125 nginx: worker process
           ├─6126 nginx: worker process
           ├─6127 nginx: worker process
           ├─6128 nginx: worker process
           ├─6129 nginx: worker process
           ├─6130 nginx: worker process
           ├─6131 nginx: worker process
           ├─6132 nginx: worker process
           ├─6133 nginx: worker process
           ├─6134 nginx: worker process
           ├─6135 nginx: worker process
           └─6136 nginx: worker process

May 05 01:33:40 Headsrv systemd[1]: Starting A high performance web server and a reverse proxy server...
May 05 01:33:40 Headsrv systemd[1]: Started A high performance web server and a reverse proxy server.

I have tried to run the command grep -r "127.0.0.1:80" /* and grep -r "nginx -g daemo" /* but no results, were the hell is nginx getting this port conf!?! Any tips for troubleshooting is gold to me since i've run in to a wall now..

And before someone ask i have edited /etc/nginx/conf.d/wok.conf and /etc/nginx/sites-available/default to not using port 80

3 Answers 3

1

I just had this problem with Debian 10 running openmediavault (OMV). After a restart (where the system had been running for months), the nginx instance that serves the OMV web interface on port 88 suddenly also served an nginx welcome page (from /usr/share/nginx/html/index.html) on port 80. Pretty annoying as I have a Nextcloud instance supposed to be available on that port.

The reason was that some time during some upgrade process, the following lines had been added to the end of the http config in /etc/nginx/nginx.conf:

...
http {
    ...

    client_max_body_size 0;

    server {
        client_max_body_size 0;
    }
}
...

Because the server part doesn't specify a listen directive, it defaults to port 80. And because no root directive was specified, it defaults to /usr/share/nginx/html on my particular system.

Edit It turns out that I actually did the change myself when following this guide to setup my system.

0

What about in /etc/nginx/nginx.conf? Make sure that you comment out the ports that are listening from the default nginx.conf file. You only listed the locations in the conf.d sections...

There may be something like this in there:

server {
  listen       80 default_server;
  listen       [::]:80 default_server;
  server_name  _;
    root         /usr/share/nginx/html;

Sorry would have just commented this, but don't have enough rep yet on askubunut.com

3
  • Did a "grep 80 /etc/nginx/nginx.conf" yields no hits.
    – Sandoz
    May 6, 2018 at 7:42
  • Does a grep -rnw /etc/nginx/ "80" show anything in the NGINX folder using just 80? Im guessing that when you turn off the service for NGINX and restart apache, your apache works?
    – saleetzo
    May 7, 2018 at 20:33
  • 1
    You mean grep -rnw 80 /etc/nginx/ It yields results /etc/nginx/koi-win:4: 80 88 ; # euro /etc/nginx/koi-utf:10: 80 E282AC ; # euro But thats nothing as i can see :)
    – Sandoz
    May 24, 2018 at 15:47
-2

Try to remove the whole section:

http {
    ....
    ....
}

Then, restart nginx.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .