小编Jub*_*bin的帖子

如何为 Laravel 项目中的某些路由设置超时?

我有一个关于 Laravel 的项目。我有网页路由和api路由。我的问题是:如何为这两组设置不同的超时时间?

我尝试使用中间件,只是玩玩set_time_limit,但没有用。

所以我想我可以通过我的 Nginx vhost 文件来做到这一点,我有点坚持这一点。到目前为止,我是如何结束的:

server {
    listen 80;
    listen 443 ssl http2;
    server_name mysiste;
    root "/home/vagrant/www/mysite/public";

    index index.html index.htm index.php;

    charset utf-8;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }


    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  /var/log/nginx/mysite-error.log error;

    sendfile off;

    client_max_body_size 100m;

    location ~ \.php$ {
         fastcgi_split_path_info ^(.+\.php)(/.+)$;
         fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
         fastcgi_index index.php;
         include fastcgi_params;
         fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

         fastcgi_intercept_errors off; …
Run Code Online (Sandbox Code Playgroud)

configuration timeout nginx laravel

1
推荐指数
1
解决办法
1396
查看次数

标签 统计

configuration ×1

laravel ×1

nginx ×1

timeout ×1