OPNsense Forum

English Forums => Web Proxy Filtering and Caching => Topic started by: thewolf56 on July 14, 2021, 05:26:23 am

Title: NGINX Error on Setup
Post by: thewolf56 on July 14, 2021, 05:26:23 am
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
Title: Re: NGINX Error on Setup
Post by: mimugmail on July 14, 2021, 10:06:44 pm
sockstat -4 | grep 80 is really empty? Usually its only the redirect rule
Title: Re: NGINX Error on Setup
Post by: 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.
Title: Re: NGINX Error on Setup
Post by: thewolf56 on July 15, 2021, 02:30:17 am
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

Code: [Select]
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        *:*
Title: Re: NGINX Error on Setup
Post by: thewolf56 on July 15, 2021, 02:31:02 am
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.
Title: Re: NGINX Error on Setup
Post by: thewolf56 on July 15, 2021, 06:10:23 am
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...
Title: Re: NGINX Error on Setup
Post by: 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 ..
Title: Re: NGINX Error on Setup
Post by: thewolf56 on July 15, 2021, 07:01:34 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.