【发布时间】:2018-08-05 21:39:32
【问题描述】:
我最近将一个 CakePHP 项目导入了一个新服务器,并且能够加载 webroot,例如example.com 但是,当我转到 example.com/pages/about 或 example.com/pages/contact 时,我得到一个 404。我正在使用 Nginx,我认为它没有正确配置,因为相同的 CakePHP 项目部署在不同的服务器。 (我对 CakePHP 不是很了解,但使用过类似的 PHP MVC 框架,例如 Laravel)
server {
listen 80 default_server;
listen [::]:80 default_server;
root /home/me/directory/webroot;
autoindex off;
index index.php;
server_name _;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
}
}
我想知道是什么未正确配置导致任何非根 uris 为 404。
【问题讨论】:
-
你看过文档中的the sample configuration 吗?