nginx: configuration file /etc/nginx/nginx.conf test failed

My websites just crashed and I am trying to find out the problem. While looking i found out that the nginx.conf file is empty, i do have a backup of that file but when i try to replace is the one i have on my local machine i get an error of "Critical File transfer error". (I am using Filezilla as the FTP). Now i was inpecting the nginx after i ssh into the sever. While using the command "nginx -t" i got this result:

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: [emerg] no "events" section in configuration
nginx: configuration file /etc/nginx/nginx.conf test failed

1 Answer

You could try opening the config in SSH using nano /etc/nginx/nginx.conf then copying the contents of the backed up config to your clipboard, then pasting it in your open file (CTRL+V or right click anywhere in the SSH window, depending on SSH client) then saving by doing CTRL+X, then Y, finally ENTER.

If the backup is in your server, then do cp /path/to/backup /etc/nginx/nginx.conf.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like