【发布时间】:2016-03-29 14:17:56
【问题描述】:
我在使用 nginx 时遇到了一些问题。 我在 Symfony3 上创建了新项目。 Config.php 说,一切都很好。 dev_app.php - 也是。 但是当我尝试在没有任何其他路由的情况下打开站点时,例如 sitename.com nginx 返回 403 错误。 当我尝试启动 symfnoy 服务器(bin/console server:start)时,它也是被禁止的。 sitename.com:8000 返回我无法打开此页面。
站点可用配置是
upstream phpfcgi {
server 127.0.0.1:8000;
}
server {
listen 80;
server_name localhost;
root /home/staging/www/web;
error_log /home/staging/logs/staging.error.log;
access_log /home/staging/logs/staging.access.log;
location / {
index app.php;
try_files $uri @rewriteapp;
}
location @rewriteapp {
rewrite ^(.*)$ /app.php/$1 last;
}
# pass the PHP scripts to FastCGI server from upstream phpfcgi
location ~ ^/(app|app_dev|config)\.php(/|$) {
fastcgi_pass phpfcgi;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS off;
}
}
我用 crud 添加了新实体,但任何操作都不起作用。 我会很高兴得到任何帮助。谢谢
【问题讨论】:
-
你查看过 nginx 和 PHP 日志吗?您的目录权限设置正确吗?
-
你考虑过reading the manual 吗?
-
是的,我阅读了手册。此代码也不起作用。日志为空
-
有没有可能 /app.php/$1 应该是 /app.php$1 ?