【发布时间】:2014-02-09 03:56:15
【问题描述】:
我对 nginx 相当陌生,并认为使用它来提供 php 会非常简单,因为这种设置非常常见,但它似乎比我预期的要复杂得多。
这是我的配置..
server {
listen 80;
server_name domain.com www.domain.com;
location / {
root /srv/www/domain.com/public_html;
index index.php;
}
# serve static files directly
#location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt)$
# access_log off;
# expires 30d;
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
fastcgi_pass /var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
如果我用“index.html”文件替换“index.php”,nginx 会完美地提供 html。
我看过一些指南建议修改任何内容,从 iptables 到 php-fpm 到 php.ini,再到 fast-cgi 到 sites-available..?
我不确定这些教程中的许多到底想做什么......现在我只想让我的 index.php 提供 phpinfo()。排除 404 错误的下一步是什么?
是否有一个明确的指南来介绍可用于使用 nginx 提供 php 的各种选项?
Debian Wheezy 7.3 on xen
【问题讨论】: