Hi, I am soon to set up a new server which is replacing an old one which is currently running apache. I've been dabbling with lighttpd but I really want to use Nginx because, well basically, it's cool!
Anyhow, I have a shared PHP app which will serve several different websites but I'm stuck (and perhaps slightly confused) with how I should actually approach this. Normally in Apache I would setup an alias and that's it. I'm currently taking the symlink approach which works fine for say phpmyadmin but my PHP app is slightly different where it uses a sort of similar method to Codeigniter. Basically the .htaccess rule is ^(.*)$ index.php?$1 [NC,L] so it ends up like index.php?foo/bar/.. and so on to PHP but accessed like http://foo.com/admin/foo/bar.
Problem I'm having right now is I can't get fastcgi_split_path_info to work and I end up with an empty PATH_INFO and SCRIPT_NAME. I know I'm doing something wrong but I just can't see it.
Here's my config anyway which is currently incomplete as I'm trying to build it up:
/mushin/admin is a symlink to the shared PHP app in /usr/share/
server {
listen 80;
server_name mrkennie.kicks-ass.net;
index index.php index.html index.htm;
root /home/customers/webs/kryogenic/mrkennie.kicks-ass.net/www/;
location ~ /mushin/admin/(.*)$ {
try_files $uri $uri/ /index.php?$1;
}
location ~ ^.+\.php {
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
}
I'm at the understanding that $fastcgi_path_info and $fastcgi_script_name should be set by fastcgi_split_path_info, assuming there is a match but they are both blank.
I'm using Nginx 1.2.1 and php5-fpm 5.4.6 on Ubuntu 12.10.
I hope this all makes sense, I'm not very good at trying to explain things. I've been trying to avoid the pitfalls that I've been reading on the wiki and trying to do everything the Nginx way. I know I'm doing something wrong but very keen to learn!
Anyhow, I have a shared PHP app which will serve several different websites but I'm stuck (and perhaps slightly confused) with how I should actually approach this. Normally in Apache I would setup an alias and that's it. I'm currently taking the symlink approach which works fine for say phpmyadmin but my PHP app is slightly different where it uses a sort of similar method to Codeigniter. Basically the .htaccess rule is ^(.*)$ index.php?$1 [NC,L] so it ends up like index.php?foo/bar/.. and so on to PHP but accessed like http://foo.com/admin/foo/bar.
Problem I'm having right now is I can't get fastcgi_split_path_info to work and I end up with an empty PATH_INFO and SCRIPT_NAME. I know I'm doing something wrong but I just can't see it.
Here's my config anyway which is currently incomplete as I'm trying to build it up:
/mushin/admin is a symlink to the shared PHP app in /usr/share/
server {
listen 80;
server_name mrkennie.kicks-ass.net;
index index.php index.html index.htm;
root /home/customers/webs/kryogenic/mrkennie.kicks-ass.net/www/;
location ~ /mushin/admin/(.*)$ {
try_files $uri $uri/ /index.php?$1;
}
location ~ ^.+\.php {
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
}
I'm at the understanding that $fastcgi_path_info and $fastcgi_script_name should be set by fastcgi_split_path_info, assuming there is a match but they are both blank.
I'm using Nginx 1.2.1 and php5-fpm 5.4.6 on Ubuntu 12.10.
I hope this all makes sense, I'm not very good at trying to explain things. I've been trying to avoid the pitfalls that I've been reading on the wiki and trying to do everything the Nginx way. I know I'm doing something wrong but very keen to learn!