Saturday, January 7, 2012

Nginx Upgrade Deletes/Overwrites Configuration Folder

After an Nginx upgrade, the browser can't
connect to your server , yet your servers are
running and the error logs are OK
I was recently upgrading Nginx on Linux, and after the upgrade, I noticed that all my sites were unavailable, giving the error "couldn't establish connection to the server". 

The next thing is panicking, and going through the logs to see what could have gone wrong. The logs claim to have no idea of any error, or wrong doing, and you are still clueless.

It took me a while to find out that my server configurations, stored under the /etc/nginx/conf folder in a file named default.conf  had disappeared , and the file was blank.

It took me a while, and just as I was re-adding my directives, I noticed something in the install logs during the upgrade. The upgrade to Nginx had renamed the default.conf file to default.conf.rpmnew . 

Renaming the file back and restarting Nginx (sudo /etc/init.d/nginx restart ) in Fedora/CentOS/Redhat should have you sorted out.