NGINX/PHP downloading instead of executing

Posted by Travis D on Stack Overflow See other posts from Stack Overflow or by Travis D
Published on 2011-11-17T01:09:49Z Indexed on 2011/11/17 1:51 UTC
Read the original article Hit count: 240

Filed under:
|
|

I have an NGINX server with fastcgi/PHP running on it. I need to add userdirs to it, but I can't get PHP to execute the files - it just asks me if I want to download it. It does work without the userdir (eg: it works on physibots.info/hugs.php, but not physibots.info/~kisses/hugs.php)

Any help is greatly appreciated.

Config: server { listen 80; server_name physibots.info; access_log /home/virtual/physibots.info/logs/access.log;

    root /home/virtual/physibots.info/public_html;

    location ~ ^/~(.+?)(/.*)?\.php$ {
        fastcgi_param SCRIPT_FILENAME /home/$1/public_html$fastcgi_script_name;
        fastcgi_pass unix:/tmp/php.socket;
    }

    location ~ ^/~(.+?)(/.*)?$ {
        alias /home/$1/public_html$2;
        autoindex on;
    }

    location ~ \.php$ {
        try_files $uri /error.html/$uri?null;
        fastcgi_pass unix:/tmp/php.socket;
    }

}

© Stack Overflow or respective owner

Related posts about php

Related posts about nginx