I get download of my site after I deleted "default" in /etc/nginx/sites-available! How fix it?

Posted September 30, 2015 2.5k views

I deleted the file “default” in that directory /etc/nginx/sites-available and create a new file with the name of my site, but I think the information are incomplete now, because when I access my site in php I get download the site, don’t show the page!

How I fix it?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

Did you set up nginx to pass php files to php5-fpm? There should be something like this in your nginx virtualhost’s config:

        location ~ \.php$ {
                try_files $uri =404;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;


If not, install php5-fpm and add the location {} block inside the server {} block and restart Nginx.

sudo apt-get install php5-fpm