Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

nginx server is downloading the php files instead of executing them

I tried every solution that has been posted around web

most of the people had problem with location

but mine is uncommented already

my default conf file

server {
    #listen   80; ## listen for ipv4; this line is default and implied
    #listen   [::]:80 default ipv6only=on; ## listen for ipv6

    root /usr/share/nginx/www;
    index index.php index.html index.htm;

    # Make site accessible from http://localhost/
    server_name test.com;

    location / {
            # First attempt to serve request as file, then
            # as directory, then fall back to index.html
            try_files $uri $uri/ /index.html;
            # Uncomment to enable naxsi on this location
            # include /etc/nginx/naxsi.rules
    }

    location /doc/ {
            alias /usr/share/doc/;
            autoindex on;
            allow 127.0.0.1;
            deny all;
    }

    # Only for nginx-naxsi : process denied requests
    #location /RequestDenied {
            # For example, return an error code
            #return 418;
    #}

    error_page 404 /404.html;


    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

    location ~ \.php$ {
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
    #       # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
    #       # With php5-cgi alone:
    #       fastcgi_pass 127.0.0.1:9000;
    #       # With php5-fpm:
            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;
    }

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #       deny all;
    #}
}
share|improve this question
    
That looks fine. What example of a URL is failing? –  Michael Hampton Mar 12 at 22:10
    
test.com/phpmyadmin/index.php or test.com/index.php is failing –  user19212 Mar 12 at 22:12
    
What's wrong with that URL? –  Michael Hampton Mar 12 at 22:13
    
Nothing is wrong.i dont know why nginx is downloading files.. do you think is it beacuse of php5-fpm or fastcgi ? if it is how can i check ? –  user19212 Mar 12 at 22:14
1  
No it isn't, it gives me the login form as it seems to be intended to do. Did you do something silly like fail to clear your browser cache? –  Michael Hampton Mar 12 at 22:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.