0

我使用这个配置:

root /www/mysite/static
location / {
    try_files $uri @php;
}
location @php {
    fastcgi_pass 127.0.0.1:9000;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME /www/mysite/controller$fastcgi_script_name.php;
}

这将首先检查 /www/mysite/static 是否有该文件。如果找不到该文件,那么它将在“file.php”上运行 fastcgi。

现在,如果我访问 www.mysite.com/asdf,它将尝试使用不存在的 /www/mysite/controller/asdf.php 运行 fastcgi。

我读到如果语句是邪恶的,那么我应该怎么做呢?

4

1 回答 1

0

Finally figured it out:

location /info {
    root /usr/share/nginx/www;
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME /usr/share/nginx/www/info.php;
}

Actually makes sense now as I've bothered to read the documentation...

于 2013-11-28T13:39:36.763 回答