问题是这样的,我有两个虚拟主机 bbs 和public
server
{
listen 80;
server_name bbs.test.com;
index index.php index.html index.htm default.html default.htm default.php;
root /home/test/projects/bbs;
location ~ .*\.(php|php5)?$
{
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fcgi.conf;
}
location ~* /(\w+)/(\w+)$ {
proxy_pass http://public.test.com;
proxy_set_header Host public.test.com;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
}
}
server
{
listen 80;
server_name public.test.com;
index index.php index.html index.htm default.html default.htm default.php;
root /home/test/projects/public;
location / {
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=$1 last;
}
}
location ~ \.php($|/)
{
set $script $uri;
set $path_info "";
if ($uri ~ "^(.+?\.php)(/.+)$") {
set $script $1;
set $path_info $2;
}
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fcgi.conf;
fastcgi_param SCRIPT_FILENAME $document_root$script;
fastcgi_param SCRIPT_NAME $script;
fastcgi_param PATH_INFO $path_info;
}
}
他们都包含了 fcgi.conf这个配置文件,我在这个配置文件里面放了一段lua脚本,以便任何php脚本都必须执行。
但是我发现在bbs.test.com中当匹配到 /(\w+)/(\w+) 这个location时 如bbs.test.com/pan/index,服务器向public.test.com取数据时并不执行lua脚本了
但是我单独用如public.test.com/pan/index访问时是执行了lua脚本的,我想问为什么proxy_pass后lua脚本就不执行了呢?这种情况,如果我一定要执行的话,怎么办才好呢?