0

我正在研究一个小的反应登录模式。我面临的问题是,当我使用时, axios.post('/login', { username, password }) 我只是从 ddev ( https://github.com/drud/docker.nginx-php-fpm-local/blob/master/files/usr/share得到一个通用的 nginx 错误/nginx/html/40x.html )

我检查了两者php-fpmnginx在没有任何有用信息的情况下记录了日志。

我不知道可能是什么问题,但遵循正在使用的配置文件:

map $http_x_forwarded_proto $fcgi_https {
    default off;
    https on;
}

server {
    listen 80;
    listen [::]:80 default ipv6only=on;

    root $NGINX_DOCROOT/public;

    index index.php index.htm index.html;

    server_name _;

    sendfile off;
    error_log /var/log/nginx/error.log info;
    access_log /var/log/nginx/access.log;

    location / {
        absolute_redirect off;
        try_files $uri $uri/ /index.php?q=$uri&$args;
    }

    location ~ \.php$ {
        try_files try_files $uri $uri/ /index.php$is_args$args;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/run/php-fpm.sock;
        fastcgi_buffers 16 16k;
        fastcgi_buffer_size 32k;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param SCRIPT_NAME $fastcgi_script_name;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_intercept_errors on;
        # fastcgi_read_timeout should match max_execution_time in php.ini
        fastcgi_read_timeout 10m;
        fastcgi_param SERVER_NAME $host;
        fastcgi_param HTTPS $fcgi_https;
    }

    location ~* \.(?:rss|atom)$ {
        expires 1h;
    }

    location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
        expires 1M;
        access_log off;
        add_header Cache-Control "public";
    }

    location ~* /\.(?!well-known\/) {
        deny all;
    }

    location ~* (?:\.(?:bak|conf|dist|fla|in[ci]|log|psd|sh|sql|sw[op])|~)$ {
        deny all;
    }

    location ^~ /system/files/ {
        log_not_found off;
        access_log off;
        expires 30d;
        try_files $uri @rewrite;
    }

    location /healthcheck {
        access_log off;
        stub_status     on;
        keepalive_timeout 0;    # Disable HTTP keepalive
        return 200;
    }

    error_page 400 401 /40x.html;
    location = /40x.html {
            root   /usr/share/nginx/html;
    }

    location ~ ^/(fpmstatus|ping)$ {
        access_log off;
        stub_status     on;
        keepalive_timeout 0;    # Disable HTTP keepalive
        allow 127.0.0.1;
        allow all;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
        fastcgi_pass unix:/run/php-fpm.sock;
    }
}

提前致谢!

4

2 回答 2

1

This should work without issues starting with ddev v1.8.0, as the offending nginx 40x handling was removed in https://github.com/drud/ddev/pull/1555 - Thanks for the community PR @AronNovak.

于 2019-05-15T13:34:48.917 回答
1

问题是:

error_page 400 401 /40x.html;
location = /40x.html {
        root   /usr/share/nginx/html;
}

评论这个块修复了它。

于 2018-08-30T01:23:12.823 回答