SSL Issue - invalid number of arguments in "server_name"


crummy82
Go to solution Solved by ljm42,

Recommended Posts

Hi, I am sort of a newb to UnRAID but I do know Linux and I'm trying to figure out what happened here.. I just purchased my license yesterday and it asked me if I wanted to add my server to my account at unraid.net so I thought, sure. So I did. Then in settings, I clicked the button to create an SSL cert because I thought I would change my connectivity to https and then maybe try out the remote connectivity feature. I needed to move my server to its permanent home so I correctly powered it down, moved it, and powered it back up. Now I have no WebGUI. Going to http://192.168.1.23 gives me "connection refused". Going to https://192.168.1.23 gives me the self-signed cert warning, then I accept, and then I get an error page "ERR_HTTP2_PROTOCOL_ERROR". Shares and SSH etc. seem to be working fine. Checking the logs, I found Nginx throwing the following error. -

2022/09/12 09:18:13 [emerg] 3149#3149: invalid number of arguments in "server_name" directive in /etc/nginx/conf.d/servers.conf:59

 

When I look at the file on that line, it shows an empty server_name like below. But I cannot change this without it overwriting it to empty again.

server_name    ;

 

I have attached the diagnostics zip. Thanks all!

unraid-diagnostics-20220912-0831.zip

Link to comment
33 minutes ago, ljm42 said:

The server's IP is 192.168.8.23, not 192.168.1.23. But I'm guessing that was just a typo in your message?

 

It sounds like you have shell access, would you please run this to regenerate the nginx config files?

/etc/rc.d/rc.nginx reload

 

root@unraid:~# /etc/rc.d/rc.nginx reload
Nginx is not running

 

and yes, It is 192.168.8.23.

Link to comment
6 minutes ago, ljm42 said:

oh since it is currently stopped we probably need:

/etc/rc.d/rc.nginx start

 

Yeah, I have tried those. But since it sees the config file as invalid with the empty server_name, it won't start and throws the same error. If I add a server name and try to start it, it still throws the error and upon looking at servers.conf, the server_name variable is empty again.

root@unraid:~# /etc/rc.d/rc.nginx start
Starting Nginx server daemon...
nginx: [emerg] invalid number of arguments in "server_name" directive in /etc/nginx/conf.d/servers.conf:61

 

Link to comment
2 minutes ago, ljm42 said:

The rc.nginx script rebuilds the nginx config files, which is why your manual changes get replaced.

 

Would you please copy/paste the results of this?

cat /var/local/emhttp/network.ini

 

Yeah, I was looking at the rc.nginx file to see what it was trying to do. It looks like it can't come up with $LANFQDN. Here is my network.ini..

root@unraid:~# cat /var/local/emhttp/network.ini
[eth0]
DHCP_KEEPRESOLV="yes"
DNS_SERVER1="192.168.8.6"
DNS_SERVER2="192.168.8.7"
DNS_SERVER3=""
DHCP6_KEEPRESOLV="no"
BONDING="no"
BONDNAME=""
BONDNICS=""
BONDING_MODE="1"
BONDING_MIIMON="100"
BRIDGING="yes"
BRNAME="br0"
BRNICS="eth0"
BRSTP="no"
BRFD="0"
DESCRIPTION:0=""
PROTOCOL:0="ipv4"
USE_DHCP:0="yes"
IPADDR:0=""
NETMASK:0="0.0.0.0"
GATEWAY:0=""
METRIC:0=""
USE_DHCP6:0="yes"
IPADDR6:0=""
NETMASK6:0=""
GATEWAY6:0=""
METRIC6:0=""
PRIVACY6:0=""
MTU=""
TYPE="access"
[eth1]
BONDING="no"
BONDNAME=""
BONDNICS=""
BONDING_MODE="1"
BONDING_MIIMON="100"
BRIDGING="yes"
BRNAME="br1"
BRNICS="eth1"
BRSTP="no"
BRFD="0"
DESCRIPTION:0="LAN1"
PROTOCOL:0="ipv4"
USE_DHCP:0="no"
IPADDR:0="192.168.8.23"
NETMASK:0="255.255.255.0"
GATEWAY:0="192.168.8.1"
METRIC:0=""
USE_DHCP6:0=""
IPADDR6:0=""
NETMASK6:0=""
GATEWAY6:0=""
METRIC6:0=""
PRIVACY6:0=""
MTU=""
TYPE="trunk"
[eth2]
BONDING="no"
BONDNAME=""
BONDNICS=""
BONDING_MODE="1"
BONDING_MIIMON="100"
BRIDGING="yes"
BRNAME="br2"
BRNICS="eth2"
BRSTP="no"
BRFD="0"
DESCRIPTION:0=""
PROTOCOL:0="ipv4"
USE_DHCP:0="yes"
IPADDR:0=""
NETMASK:0="0.0.0.0"
GATEWAY:0=""
METRIC:0=""
USE_DHCP6:0=""
IPADDR6:0=""
NETMASK6:0=""
GATEWAY6:0=""
METRIC6:0=""
PRIVACY6:0=""
MTU=""
TYPE="trunk"

 

Link to comment
1 hour ago, ljm42 said:

The rc.nginx script rebuilds the nginx config files, which is why your manual changes get replaced.

 

Would you please copy/paste the results of this?

cat /var/local/emhttp/network.ini

 

 

I was able to get into the WebGUI. Since rc.nginx checks for a cert called "certificate_bundle.pem" in the certs directory, I renamed that file. It then appears to start up OK since the script doesn't create those extra lines for a new server in the nginx config file. I have also been able to enable HTTPS in the "Use TLS/SSL" management setting and have it use port 4443 instead. It's working fine using the self-signed cert. However, the MyServers function appears broken now and I cannot log out of it either. If I put the "certificate_bundle.pem" back in place or use the "Provision" button to get a new cert, Nginx will no longer start and fails with the previous issues again.

Link to comment
33 minutes ago, ljm42 said:

perfect.

 

Please go to Settings -> Network Settings -> Interface rules and reassign things so that your current eth1 is recognized as eth0. Once you have an ip on eth0 you should be able to provision a cert.

 

Thank you, sir. That was it! It had to be on eth0. eth0 was the internal Realtek NIC I didn't want to use. I'm using an Intel PCIe NIC that gave me eth1 and eth2. I didn't even know I could rearrange the order. It's a good thing I had physical access to the box after reconfiguring them! That's an interesting quirk to the rc.nginx that could cause some other people problems if it's only checking for eth0. I'm no bash script expert so I couldn't tell how it was getting the $LANIP or $LANFQDN in there. 

Link to comment

Great, glad to hear it!

 

Yeah that makes sense to avoid the Realtek NIC

 

There are actually many places in Unraid that assume eth0 exists, TBH I'm a little surprised you were able to get this far without it :) You may find that it fixes other things as well.

 

24 minutes ago, crummy82 said:

It's a good thing I had physical access to the box after reconfiguring them!

 

Hmm sorry about that. So after you rearranged the NICs and hit save, you lost access? How did you resolve it, press the power button?

Link to comment
13 minutes ago, ljm42 said:

Great, glad to hear it!

 

Yeah that makes sense to avoid the Realtek NIC

 

There are actually many places in Unraid that assume eth0 exists, TBH I'm a little surprised you were able to get this far without it :) You may find that it fixes other things as well.

 

 

Hmm sorry about that. So after you rearranged the NICs and hit save, you lost access? How did you resolve it, press the power button?

 

After I rearranged them and hit save, it said I needed to reboot to go into effect. I had a feeling this would be the case and I'd lose connectivity. It made my connected Intel interface eth0 and the second intel interface (disconnected) eth1 as I had rearranged it. After the reboot, the disconnected interface was assigned the static IP since it was now eth1. I had to move the cable to that second Intel interface, remove the static IP, move the cable to Intel primary interface, find its DHCP IP, log in, and re-assign it the static IP.  Being a network engineer, it wasn't too much of a headache. Seems good to go though. Thx!

  • Like 1
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.