Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"configuration file /etc/nginx/nginx.conf test failed": How do I know why this happened?

Tags:

nginx

I'm an nginx noob trying out this this tutorial on nginx 1.1.19 on ubuntu 12.04. I have this nginx config file.

When I run this command the test fails:

$ sudo service nginx restart Restarting nginx: nginx: [crit] pread() "/etc/nginx/sites-enabled/csv" failed (21: Is a directory) nginx: configuration file /etc/nginx/nginx.conf test failed 

How do I know why the nginx.conf test failed?

like image 658
bernie2436 Avatar asked Mar 10 '14 16:03

bernie2436


People also ask

How do I find my nginx config file?

Through a simple command you can verify the status of the Nginx configuration file: $ sudo systemctl config nginx The output will show if the configuration file is correct or, if it is not, it will show the file and the line where the problem is.

What is the configuration file of nginx?

By default, the configuration file is named nginx. conf and placed in the directory /usr/local/nginx/conf , /etc/nginx , or /usr/local/etc/nginx .

Where is nginx config file in Linux?

In addition to @Daniel Li's answer, the nginx installation with Valet would use the Velet configuration as well; this is found in /usr/local/etc/nginx/valet/valet. conf . The nginx. conf file would have imported this Valet conf file.


2 Answers

sudo nginx -t should test all files and return errors and warnings locations

like image 184
Mohammad AbuShady Avatar answered Oct 02 '22 13:10

Mohammad AbuShady


This particular commands worked for me. sudo apt-get remove --purge nginx nginx-full nginx-common

and sudo apt-get install nginx

credit to this answer on stackexchnage

like image 26
Eric Avatar answered Oct 02 '22 12:10

Eric