0
我试图在虚拟文件夹中托管一个symfony应用程序,并使用nginx重写url。在nginx上的虚拟目录中托管symfony
我发现随着各种例子,我坚持了这样的事情:
upstream phpfcgi {
server unix:/var/run/php5-fpm.sock;
}
server {
listen 443;
server_name localhost;
root /realpath/Symfony/web/;
[ssl stuff]
# strip app.php/ prefix if it is present
rewrite ^/app_dev\.php/?(.*)$ /$1 permanent;
location /virtual{
alias /realpath/Symfony/web/;
index app_dev.php;
try_files $uri @rewriteapp;
}
location @rewriteapp {
rewrite ^/virtual/(.*)$ /app_dev.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 on;
}
}
如果我删除从两个第一位置/virtual
,它的正常工作。 我应该在第三个位置设置SCRIPT_URI吗?
感谢您的帮助
你肯定'fastcgi_param SCRIPT_FILENAME $ DOCUMENT_ROOT $ fastcgi_script_name;'是正确的?错误,我们需要更多的错误消息 – DRC 2014-12-01 16:13:29
没有/虚拟,它似乎是这样的情况下,应用程序运行良好。使用虚拟的,app_dev.php文件被找到,但symfony没有找到路由。 '找不到“GET /虚拟”的路线 – 2014-12-01 16:47:20