I'm running on a server that has Apache on port 80. I also have nginx installed, and just one conf file in /etc/nginx/sites-enabled
which has listen 8888;
specified. This works perfectly fine.
Now, I added a second conf file for a different vhost within /etc/nginx/sites-enabled
, listening on port 7979. When I run sudo service nginx restart
, I get:
Restarting nginx: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] still could not bind()
nginx.
Nowhere in any file within /etc/nginx
is port 80 mentioned! And the only reason I used a different port (7979) is because if both vhosts had port 8888, one would simply redirect to the other, even though they have different server_name
values.
What's going on here?