【发布时间】:2016-10-14 07:46:13
【问题描述】:
我正在尝试在 ubuntu 的 nginx 服务器上运行一个 php 应用程序。我确实将所有文件都放在了 var/www/mydomain.com.html 中,它完美地呈现了我的 index.php。但是即使这些文件存在于同一目录中,也会为每个其他页面显示 404 Not Found。
这是我的服务器块配置。
server {
listen 80; ## listen for ipv4; this line is default and implied
listen [::]:80; ## listen for ipv6
root /var/www/app.limoposter.com/html;
index index.php index.html index.htm;
server_name app.limoposter.com www.app.limoposter.com;
location / {
try_files $uri $uri/ =404;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
【问题讨论】:
标签: php web-services .htaccess nginx vps