ICode9

精准搜索请尝试: 精确搜索
首页 > 系统相关> 文章详细

php/nginx/axios: 文件上传: 配置最长执行时间等相关项 (php8.1.1 / nginx 1.18.0 / vue@3.2.26 )

2022-01-21 22:03:20  阅读:242  来源: 互联网

标签:26 axios lhdpc 60 nginx vue timeout php


 一,php配置文件大小和超时时间

1,编辑配置文件:
root@lhdpc:~# vi /usr/local/soft/php8/etc/php.ini 
上传文件大小
upload_max_filesize = 2M
设置为128M或需要的数值   post的大小:
post_max_size = 8M
设置为128M或需要的数值   最长执行时间:
max_execution_time = 30
设置为60秒   2,设置完成后重启php
root@lhdpc:~# systemctl restart php-fpm.service

说明:刘宏缔的架构森林是一个专注架构的博客,地址:https://www.cnblogs.com/architectforest

         对应的源码可以访问这里获取: https://github.com/liuhongdi/
         或: https://gitee.com/liuhongdi

说明:作者:刘宏缔 邮箱: 371125307@qq.com

二,nginx配置数据大小和时长

修改配置文件
root@lhdpc:/etc/nginx# vi nginx.conf 
配置内容:
        client_max_body_size 128m;
 
        keepalive_timeout  60;
        fastcgi_connect_timeout 60;
        fastcgi_send_timeout 60;
        fastcgi_read_timeout 60;
 
        proxy_connect_timeout       60;
        proxy_send_timeout          60;
        proxy_read_timeout          60;
        send_timeout                60;

三,vue中给axios配置时长

设置超时时间为60s
let config = {
    timeout:60000,
};
 
const _axios = axios.create(config);
…

四,查看效果:

一个用时15s的例子:

五,查看nginx/php/vue的版本:

nginx:
root@lhdpc:/etc/nginx# nginx -V
nginx version: nginx/1.18.0 (Ubuntu)
built with OpenSSL 1.1.1l  24 Aug 2021
TLS SNI support enabled
configure arguments:….
 php:
root@lhdpc:/etc/nginx# php --version
PHP 8.1.1 (cli) (built: Dec 20 2021 16:12:16) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.1, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.1, Copyright (c), by Zend Technologies 

vue:

liuhongdi@lhdpc:/data/vue/demo1$ npm list vue
demo1@0.1.0 /data/vue/demo1
├─┬ @vue/cli-plugin-babel@4.5.15
│ └─┬ @vue/babel-preset-app@4.5.15
│   └── vue@3.2.26 deduped
└─┬ vue@3.2.26
  └─┬ @vue/server-renderer@3.2.26
    └── vue@3.2.26 deduped

 

标签:26,axios,lhdpc,60,nginx,vue,timeout,php
来源: https://www.cnblogs.com/architectforest/p/15831925.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有