Report this

What is the reason for this report?

Subdomains nginx

Posted on May 10, 2014

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

 server {
        listen   80;
        server_name test.site.com;
        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?



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!

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.

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

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

@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>

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.