首页 > 解决方案 > 使用另一个网站的特定位置时从上游读取响应标头时在标准错误中发送的 FastCGI:“主脚本未知”

问题描述

我使用https://website1.inov.com访问我的网站

如果我尝试访问应该是另一个应用程序的https://website1.inov.com/backend,我会得到一个

从上游读取响应标头时在标准错误中发送的 FastCGI:“主脚本未知”

在我的虚拟主机下面:

server {
        server_name website1.inov.com www.website1.inov.com;
        root /var/www/website1/;
        index index.html;
        access_log /var/log/nginx/website1.inov.com.access.log combined if=$log_ua;
        error_log /var/log/nginx/website1.inov.com.error.log;

       # Return a 404 not found for every hidden files
        location ~ /\. {
                deny all;
                return 404;
        }

        location / {
                # Check if a file or directory index file exists, else route it to index.php.
                try_files $uri /index.html;
        }

        location /backend {
                 alias /var/www/backend;
                 index index.php;
                 try_files $uri $uri/ /backend/index.php;

                 location ~* ^/backend/(.*\.php)$ {
                 try_files  $uri $uri/ =404;
                 fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
                # fastcgi_split_path_info ^((?U).+\.php)(.*)$;
                 fastcgi_param PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin;
                 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                 fastcgi_index index.php;
                 fastcgi_param CI_ENV production;
                 fastcgi_param DOMAIN production;
                 include fastcgi.conf;
                }
        }

你能帮我么 ?谢谢

标签: phpnginx

解决方案


推荐阅读