php fastcgi main/common config
Artifex Maximus
artifexor at gmail.com
Thu Oct 14 13:24:34 MSD 2010
Hello!
Is there any main/common configuration for fastcgi php under nginx?
I mean this days I use the following configuration (thanks again Igor
for the alias idea):
server {
listen 80;
location / {
root /www/home/;
index index.php index.html index.htm;
location ~ \.php$ {
fastcgi_pass 127.0.0.1:11000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /www/home$fastcgi_script_name;
include fastcgi_params;
}
}
location /site1/ {
alias /www1/site1/;
index index.php index.html index.htm;
location ~ ^/site1/(.+\.php)$ {
alias /www1/site1/$1;
fastcgi_pass 127.0.0.1:11000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $request_filename;
include fastcgi_params;
}
}
location /site2/ {
alias /www2/site2/;
index index.php index.html index.htm;
location ~ ^/site2/(.+\.php)$ {
alias /www2/site2/$1;
fastcgi_pass 127.0.0.1:11000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $request_filename;
include fastcgi_params;
}
}
}
I would like to reduce my config to something like this:
server {
listen 80;
index index.php index.html index.htm;
location ~ \.php$ {
fastcgi_pass 127.0.0.1:11000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $MACRO_TO_REAL_PATH$fastcgi_script_name;
include fastcgi_params;
}
location / {
root /www/home/;
}
location /site1/ {
alias /www1/site1/;
}
location /site2/ {
alias /www2/site2/;
}
}
Obviously $MACRO_TO_REAL_PATH is not exists yet. The question is the
second configuration is possible with nginx 0.8.52 or not? Or might is
there any simple solution instead of lot of fastcgi stuff?
Bye,
a
More information about the nginx
mailing list