Results 1 to 5 of 5
Thread: nginx with php-fpm troubles
-
04-09-2010, 03:16 AM #1Junior Guru
- Join Date
- May 2004
- Posts
- 194
nginx with php-fpm troubles
Hello, we're using php-fpm and have trouble getting the scripts to work if we change the 'root' value in nginx.conf.
location ~ \.php$ {
root /usr/share/nginx/html ;
If we change that root to point to other directory, even if it's /usr/share/nginx/html/crap, it wouldn't work. The directory exists of course. It's like it can read the file in that directory, but not execute it. I've checked all file permissions. Anyone has any idea?
-
04-09-2010, 07:25 AM #2Aspiring Evangelist
- Join Date
- Aug 2002
- Location
- Milton Keynes
- Posts
- 354
Why are you changing the document root just for PHP? A request will come in, be matched against a .php file, at that point all the variables will be correct to pass onto php-fpm, but then you change the root and mess it up!
Can you give a better example of your directory layout & existing nginx config?
-
04-09-2010, 08:57 AM #3Junior Guru
- Join Date
- Jul 2009
- Posts
- 189
Luckily I am just searching how to setup NGINX with fpm ... check this site out => http://interfacelab.com/nginx-php-fpm-apc-awesome/
-
04-09-2010, 09:26 AM #4Aspiring Evangelist
- Join Date
- Aug 2002
- Location
- Milton Keynes
- Posts
- 354
I'm using the following as my `fastcgi_params` file:
Code:set $script $uri; set $path_info ""; if ($uri ~ "^(.+\.php)(/.+)") { set $script $1; set $path_info $2; } fastcgi_index index.php; fastcgi_param SERVER_NAME $http_host; 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_param SCRIPT_FILENAME $document_root$script; fastcgi_param SCRIPT_NAME $script; fastcgi_param PATH_INFO $path_info; fastcgi_param REQUEST_URI $request_uri; fastcgi_param DOCUMENT_URI $document_uri; fastcgi_param DOCUMENT_ROOT $document_root; fastcgi_param SERVER_PROTOCOL $server_protocol; fastcgi_param GATEWAY_INTERFACE CGI/1.1; fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; fastcgi_param REMOTE_ADDR $remote_addr; fastcgi_param REMOTE_PORT $remote_port; fastcgi_param SERVER_ADDR $server_addr; fastcgi_param SERVER_PORT $server_port; fastcgi_param SERVER_NAME $server_name; # PHP only, required if PHP was built with --enable-force-cgi-redirect fastcgi_param REDIRECT_STATUS 200;
Code:location ~ \.php($|/) { include /etc/nginx/fastcgi_params; fastcgi_pass 127.0.0.1:9000; fastcgi_ignore_client_abort on; }
e.g.
Code:if (-f $request_filename) { break; } if (!-e $request_filename) { rewrite ^(.+)$ /index.php$1 last; break; }
-
04-10-2010, 01:52 PM #5Junior Guru
- Join Date
- May 2004
- Posts
- 194
Why are you changing the document root just for PHP? A request will come in, be matched against a .php file, at that point all the variables will be correct to pass onto php-fpm, but then you change the root and mess it up!
Similar Threads
-
How to install PHP-FPM and PHP on Ubuntu?
By Sanoj_ in forum Hosting Software and Control PanelsReplies: 0Last Post: 03-15-2010, 12:09 PM -
Any dedicated host provider with nginx+php-fpm+mysql support
By hvs69 in forum Dedicated ServerReplies: 2Last Post: 01-15-2010, 02:01 PM -
Apache vs Nginx (mod_php VS php-fpm)
By bostjan in forum Hosting Security and TechnologyReplies: 7Last Post: 06-25-2009, 07:19 AM -
nginx and php issues
By djsmokin in forum Hosting Security and TechnologyReplies: 10Last Post: 03-27-2009, 02:16 PM -
nginx quirk on running encrypted script? (running with php-fpm)
By Darvil in forum Hosting Security and TechnologyReplies: 20Last Post: 10-13-2008, 06:16 PM