swoole项目部署nginx(hyperf,imi)配置ng上传反向代理等

宝塔去php配置直接删除所有禁用函数

php.ini配置

file_uploads = on  允许文件上传

upload_max_filesize = 8m 最大上传文件大小

post_max_size = 8m POST允许最大值

swoole配置

package_max_length = 2 * 1024 * 1024  上传默认为2m可以自行增加,具体可以去swoole文档搜索package_max_lengt

nginx配置

nginx上传或输出静态资源出现无权限提示基本为user xx问题,本地测试可直接配置为user root

server {
      #GZIP压缩
      gzip on;
      gzip_min_length  1024;
      gzip_buffers     4 16k;
      gzip_comp_level 9;
      gzip_types       text/plain application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png application/javascript;
      gzip_vary on;
      # 端口
      listen 8088;
      # 域名
      server_name localhost;
      # fastcgi连接关闭时长
      fastcgi_connect_timeout 300;
      fastcgi_send_timeout 300;
      fastcgi_read_timeout 300;
      # 静态资源目录配置(可以理解为上传目录)
      location /uploads/.*\.(gif|jpg|jpeg|png|txt|mp3|mp4|rmvb|mkv|avi|mov|MOV|json|ico|css|crt)$ {
        root '/usr/local/var/www/public/uploads/';
      }
      # 针对POST设置(影响性能)
      client_body_buffer_size 1024k;
      # 最大接受上传大小
      client_max_body_size 100m;

      location / {
        #反向代理到 本地9501端口
        proxy_pass http://127.0.0.1:9501;
        proxy_redirect off;
        proxy_set_header Host $host;
        #携带IP
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        #反代连接关闭最大时长
        proxy_connect_timeout 300s;
        proxy_send_timeout 300s;
        proxy_read_timeout 300s;
        #反向代理缓冲缓存大小
        proxy_buffers   4 64k;
        #反向代理存储header大小
        proxy_busy_buffers_size 128k;
        #反向代理临时文件储存大小
        proxy_temp_file_write_size 100m;
          
      }
    }

你可能感兴趣的:(nginx,swoole,php)