Subdomains nginx

Hello! When i load my browser asks whether to save the file? Nginx subdomain conf

 server {
        listen   80;
        root /usr/share/nginx/www/test;
        index index.php index.html;
        location / {
                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;

This conf works great for non php files(e.g. index.html) What i need to do?

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

@Evgenity: Make sure that part is all on one line: <br> <br><pre> <br>fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; <br></pre>

Hello! Thanks for answer. When i restart nginx its failed with error <br> <br>invalid parameter “$fastcgi_script_name”

Hi, this is a solution for you: <br> <br>server { <br> listen 80; <br> server_name test.; <br> charset utf-8; <br> <br> location / { <br> root /usr/share/nginx/www/test; <br> index index.html index.htm index.php; <br> } <br> <br> location ~ .php$ { <br> try_files $uri = 404; <br> root /usr/share/nginx/www/test; <br> fastcgi_pass unix:/tmp/php5-fpm.sock; <br> fastcgi_index index.php; <br> fastcgi_split_path_info ^(.+.php)(.)$; <br> fastcgi_param SCRIPT_FILENAME <br> $document_root $fastcgi_script_name; <br> fastcgi_intercept_errors on; <br> include /etc/nginx/fastcgi_params; <br> } <br>} <br> <br>Regards, <br>Leandro Naves