Laravel Valet 504网关超时nginx/1.19.6 60秒后

r55awzrz  于 2023-02-07  发布在  Nginx
关注(0)|答案(1)|浏览(266)

我按照所有的指示在这里:
https://github.com/laravel/valet/issues/315
我注意到了更好的性能,特别是在更新了Valet的PM池配置之后。(现在一些执行开始完成,因为所需的时间不到60秒)。
但是对于更长的执行,仍然在60秒之后显示错误。
实际上我的确认文件是这样的:

    • 代客-fpm.配置**
; FPM pool configuration for Valet

[valet]
user = xxx
group = staff
listen = /Users/xxx/.config/valet/valet.sock
listen.owner = xxx
listen.group = staff
listen.mode = 0777

;; When uncommented, the following values will take precedence over settings declared elsewhere
;php_admin_value[memory_limit] = 512M
;php_admin_value[upload_max_filesize] = 128M
;php_admin_value[post_max_size] = 128M

;php_admin_value[error_log] = /Users/xxx/.config/valet/Log/php-fpm.log
;php_admin_flag[log_errors] = on

;; Note: increasing these values will increase the demand on your CPU and RAM resources
pm = dynamic
;pm.max_children = 5
;pm.start_servers = 2
;pm.min_spare_servers = 1
;pm.max_spare_servers = 3

pm.max_children = 200
pm.start_servers = 20
pm.min_spare_servers = 10
pm.max_spare_servers = 20
pm.process_idle_timeout = 10s
pm.max_requests = 500
    • 代客配置**
server {
    listen 127.0.0.1:80 default_server;
    root /;
    charset utf-8;
    client_max_body_size 128M;

    location /41c270e4-5535-4daa-b23e-c269744c2f45/ {
        internal;
        alias /;
        try_files $uri $uri/;
    }

    location / {
        rewrite ^ "/Users/xxx/.composer/vendor/laravel/valet/server.php" last;
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    access_log off;
    error_log "/Users/xxx/.config/valet/Log/nginx-error.log";

    error_page 404 "/Users/xxx/.composer/vendor/laravel/valet/server.php";

    location ~ [^/]\.php(/|$) {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass "unix:/Users/xxx/.config/valet/valet.sock";
        fastcgi_index "/Users/xxx/.composer/vendor/laravel/valet/server.php";
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME "/Users/xxx/.composer/vendor/laravel/valet/server.php";
        fastcgi_param PATH_INFO $fastcgi_path_info;

        proxy_connect_timeout       3000;
        proxy_send_timeout          3000;
        proxy_read_timeout          3000;
        send_timeout                3000;
    }

    location ~ /\.ht {
        deny all;
    }
}
    • nginx.配置文件**
user "xxx" staff;
#worker_processes auto;
worker_processes 8;

events {
    worker_connections  1024;
}

http {
    include mime.types;
    default_type  application/octet-stream;

    sendfile on;
    keepalive_timeout  650;
    types_hash_max_size 2048;

    client_max_body_size 1024M;

    client_header_timeout 3000;
    client_body_timeout 3000;
    fastcgi_read_timeout 3000;
    fastcgi_buffers 8 128k;
    fastcgi_buffer_size 128k;


    server_names_hash_bucket_size 128;

    ssi on;

    gzip  on;
    gzip_comp_level 5;
    gzip_min_length 256;
    gzip_proxied any;
    gzip_vary on;
    gzip_types
    application/atom+xml
    application/javascript
    application/json
    application/rss+xml
    application/vnd.ms-fontobject
    application/x-font-ttf
    application/x-web-app-manifest+json
    application/xhtml+xml
    application/xml
    font/opentype
    image/svg+xml
    image/x-icon
    text/css
    text/plain
    text/x-component;

    include "/Users/xxx/.config/valet/Nginx/*";
    include servers/*;
    include valet/valet.conf;
}

我还需要修改什么?先谢了

ylamdve6

ylamdve61#

在Nginx配置中,请确保将其添加到location ~ \.php$块下

location ~ \.php$ {
    #...
    #fixes timeouts
    fastcgi_read_timeout 600;
}

相关问题