NGINX Error on Setup

Started by thewolf56, July 14, 2021, 05:26:23 AM

Previous topic - Next topic
Hello,

I tried searching for a solution before posting, but I have been unable to solve my issue of setting up NGINX with Let's Encrypt on my OPNsense firewall.

I followed this tutorial (https://forum.opnsense.org/index.php?topic=19305.0), but when I finally went to start, I received the following errors in the NGINX logs

2021/07/13   16:33:54   emerg   78826#100183   bind() to 0.0.0.0:80 failed (48: Address already in use)
2021/07/13   16:33:54   emerg   78826#100183   bind() to [::]:80 failed (48: Address already in use)
2021/07/13   16:33:54   emerg   78826#100183   still could not bind()
2021/07/13   16:34:10   emerg   99740#100114   bind() to unix:/var/run/nginx_status.sock failed (48: Address already in use)

I did a search and although I have been using https with port 440 for my GUI, I ran sockstat and found port 80 was being used by lighttpd.  Did more searching, disabled the GUI http redirect, and NGINX still would not start.

Reran sockstat and no port 80 is listed after changing the redirect setting.  Restarted the machine and no port 80 found using sockstat, but NGINX still shows the errors above with multiple bind() :80 failed messages.

Any advice would be appreciate.

Thanks

sockstat -4 | grep 80 is really empty? Usually its only the redirect rule

Another reason could be that you define stream servers and http servers in nginx using port 80. Then nginx blocks itself.

Quote from: mimugmail on July 14, 2021, 10:06:44 PM
sockstat -4 | grep 80 is really empty? Usually its only the redirect rule

It's not empty per se, but it is getting three hits that are not port 80.  One because of VLAN 180 address and two because the ports have the number 80 as part of the digits

root@OPNsense:~ # sockstat -4 | grep 80
root     ntpd       3210  31 udp4   192.168.180.1:123     *:*
root     lighttpd   58302 4  tcp4   127.0.0.1:43580       *:*
root     nc         31856 3  tcp4   127.0.0.1:8080        *:*


Quote from: fabian on July 14, 2021, 11:35:39 PM
Another reason could be that you define stream servers and http servers in nginx using port 80. Then nginx blocks itself.

I don't think I did that, but I will definitely go back and double-check.

Well, I double-checked that the stream and http servers were not sharing port 80 and that definitely was not the case as I did not have any stream servers setup (yet) in NGINX.

So, I uninstalled NGINX, updated opnsense (I'm not technically savvy enough to be on the cutting edge of fixing unknown bugs, so I usually wait a little bit for others to upgrade first), reinstalled NGINX and sure enough, it started up.

Now, I'm trying to get my Home Assistant and FreePBX VMs setup to be able to connect from the outside securely...

Now we will never know ...  8)
But it seems it was just a small problem somewhere ..

Quote from: mimugmail on July 15, 2021, 06:26:21 AM
Now we will never know ...  8)
But it seems it was just a small problem somewhere ..

It was the weirdest thing, but glad I can at least get it started now.