How to setup nginx to make php works in site subdirectories
Joe
frumentius at gmail.com
Sun Feb 12 11:11:15 UTC 2012
Hello,
Maybe you could use virtual conf, ie:
location ~ \.php$ {
root /home/example/public_html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME
/home/example/public_html$fastcgi_script_name;
include fastcgi_params;
}
Regards,
Joe
On Sun, Feb 12, 2012 at 5:59 PM, Dmitry Timoshenko <dimentiy2k at gmail.com>wrote:
> Hello,
>
> I'm nuewbie in nginx, I've installed and setup nginx & php,
> everything is fine except .php files located in site's subdirectories are
> not processed at all.
>
> i.e. example.com/download.php works fine, but
> example.com/stuff/dosomething.**php<http://example.com/stuff/dosomething.php>is sent to client as plain text.
>
> Please, would any kind soul tell me what should I change to resolve the
> problem.
> Thank you.
>
> I use those settings.
>
> #
> # example.com
> #
>
> server {
> listen 80;
> server_name example.com;
>
> access_log /var/log/nginx/example.com.**access.log;
>
> location / {
> root /var/www/nginx-default/example**.com <http://example.com>;
> index index.html index.htm index.php;
> }
>
> ## Parse all .php file in the /var/www directory
> location ~ .php$ {
> fastcgi_split_path_info ^(.+\.php)(.*)$;
> fastcgi_pass backend;
> fastcgi_index index.php;
> fastcgi_param SCRIPT_FILENAME /var/www/nginx-default/example**
> .com <http://example.com>$fastcgi_script_name;
> include fastcgi_params;
> fastcgi_param QUERY_STRING $query_string;
> fastcgi_param REQUEST_METHOD $request_method;
> fastcgi_param CONTENT_TYPE $content_type;
> fastcgi_param CONTENT_LENGTH $content_length;
> fastcgi_intercept_errors on;
> fastcgi_ignore_client_abort off;
> fastcgi_connect_timeout 60;
> fastcgi_send_timeout 180;
> fastcgi_read_timeout 180;
> fastcgi_buffer_size 128k;
> fastcgi_buffers 4 256k;
> fastcgi_busy_buffers_size 256k;
> fastcgi_temp_file_write_size 256k;
> }
>
> ## Disable viewing .htaccess & .htpassword
> location ~ /\.ht {
> deny all;
> }
> }
>
> upstream backend {
> server 127.0.0.1:9000;
> }
>
> ______________________________**_________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/**mailman/listinfo/nginx<http://mailman.nginx.org/mailman/listinfo/nginx>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20120212/82cc16bf/attachment.html>
More information about the nginx
mailing list