Symfony应用程序在另一个Nginx位置

时间:2018-08-08 11:45:22

标签: php symfony nginx

对于我们需要实现的项目,symfony应用程序位于单独的位置并具有其自己的文档根目录。

前端(Single Page React App)和后端(Symfony)是分开的。后端将通过test.domain.com/backend提供,而前端为test.domain.com/。

现在,我具有以下nginx配置:

index index.html;

root /var/www/test.domain.com/web;

access_log /var/www/test.domain.com/nginx.access.log;
error_log  /var/www/test.domain.com/nginx.error.log;

# --
# cachefree direct delivery of all allowed static media files
# --
#location ~* \.(jpg|jpeg|gif|css|png|js|ico|html)$ {
#    access_log off;
#    expires max;
#}

location / {
    try_files $uri $uri/ /index.html;
}

location ^~ /backend {
    alias /var/www/test.domain.com/backend/web;
    try_files $uri $uri/ @backend;

    location ~ \.php$ {
        fastcgi_pass 127.0.0.1:9020;
        fastcgi_split_path_info ^(.+\.php)(/.*)$;
        fastcgi_read_timeout 240;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $request_filename;
    }
}

这样我可以调用info.php文件,但是在访问app.php时却找不到404(app.php文件位于相应的目录中)。

所以我的nginx配置一定有问题,但是我不知道是什么:(

有什么想法吗?

预先感谢 问候 西蒙

0 个答案:

没有答案