发出 POST 请求后不允许 Nginx 405

时间:2021-06-02 11:35:30

标签: nginx

当我尝试从另一个服务发出 POST 请求(检查请求是否通过)时,我收到 NGINX 405 Not Allowed 错误。

在 nginx 错误日志中,我得到:

2021/06/02 13:29:20 [warn] 14018#14018: *2599 using uninitialized "subdomain" variable, client: 162.158.183.234, server: dev.example.com, request: "POST /api/callback HTTP/1.1", host: "dev.example.com"

此项目现在在 dev 子域中运行。

我的站点 nginx 配置:

server {
    server_name dev.example.com *.dev.example.com www.dev.example.com;
    charset off;
    index index.php index.html;
    disable_symlinks if_not_owner from=$root_path;
    include /etc/nginx/vhosts-includes/*.conf;
    include /etc/nginx/vhosts-resources/dev.example.com/*.conf;
    access_log /var/www/httpd-logs/dev.example.com.access.log;
    error_log /var/www/httpd-logs/dev.example.com.error.log notice;
    ssi on;
    set $root_path /var/www/www-root/data/www/dev.example.com/frontend/dist;
    gzip on;
    gzip_comp_level 5;
    gzip_disable "msie6";
    gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;
    location / {
        try_files $uri $uri/ /index.html;
    }
    root $root_path/$subdomain;
    listen 188.201.126.258:80;
    listen [2a01:4f8:112:29d2::2]:80;
}

我使用 nginx + vuejs + nestjs。哪里会出问题?我该如何解决?

0 个答案:

没有答案