Portal Home > Knowledgebase > Articles Database > nginx with php-fpm troubles
nginx with php-fpm troubles
Posted by whdev, 04-09-2010, 03:16 AM |
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?
|
Posted by drspliff, 04-09-2010, 07:25 AM |
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?
|
Posted by klikli, 04-09-2010, 08:57 AM |
Luckily I am just searching how to setup NGINX with fpm ... check this site out => http://interfacelab.com/nginx-php-fpm-apc-awesome/
|
Posted by drspliff, 04-09-2010, 09:26 AM |
I'm using the following as my `fastcgi_params` file:
Then in the specific vhost:
I wouldn't bother having a new document `root` just for PHP files unless you're doing anything specifically weird, in my case I set the document `root` once at the `server` level and perform internal rewrites for any relocation or different URL schemes.
e.g.
|
Posted by whdev, 04-10-2010, 01:52 PM |
I would like to change the root not just for PHP, but for all other file types as well. Basically I would like to use a user's home directory (example: /home/usera/, instead of /usr/share/nginx/html because then once the user ftp in, he'll be in the correct directory (home dir) to upload his files.
|
Add to Favourites Print this Article
Also Read