子目录中的 Nginx

子目录中的 Nginx

我有一些网站,有些是用 php 编写的,有些是用 nodejs 编写的,但是所有的网站都是misrv177领域

我的配置如下

默认

server {
        listen 80;
        listen [::]:80;
        root /var/www/html/;
        server_name misrv177;
        access_log  /var/log/nginx/access.log;
        error_log   /var/log/nginx/error.log;
        index index.html index.htm index.nginx-debian.html index.php;

}

前端

server {
        listen 80;
        listen [::]:80;
        root  /var/www/html/gemeos-frontend/dist;
        server_name misrv177;
        access_log  /var/log/nginx/gemeos-frontend-access.log;
        error_log   /var/log/nginx/gemeos-frontend-error.log;
        index index.html index.htm index.nginx-debian.html index.php;
        location ^~/gemeos {
                proxy_pass http://localhost:3000;
        }

}

后端

server {
        listen 80;
        listen [::]:80;
        root /var/www/html/gemeos-backend/public;
        server_name misrv177;
        access_log  /var/log/nginx/gemeos-backend-access.log;
        error_log   /var/log/nginx/gemeos-backend-error.log;
        index index.html index.htm index.nginx-debian.html index.php;
        location / {

                try_files $uri $uri/ /index.php?$query_string;
        }
        location ~ \.php$ {
        try_files $uri =404;
        fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }



}

当我尝试访问例如misrv177/gemeos它返回 404 错误

相关内容