在本地搭建swoole+laravel-s中上传文件报错,如下图: 原因是:nginx 没有配置client_body_temp_path的临时文件目录(注意权限)。 全部虚拟机配置如下:
gzip on;
gzip_min_length 1024;
gzip_comp_level 2;
gzip_types text/plain text/css text/javascript application/json application/javascript application/x-javascript application/xml application/x-httpd-php image/jpeg image/gif image/png font/ttf font/otf image/svg+xml;
gzip_vary on;
gzip_disable "msie6";
upstream em-laravels{
server 127.0.0.1:5200 weight=5 max_fails=3 fail_timeout=30s;
keepalive 16;
}
server {
listen 80;
server_name em.com;
root /Users/ywz/huanao/em/public;
access_log /usr/local/var/log/nginx/$server_name.access.log;
client_body_temp_path /usr/local/var/log/nginx/file;
autoindex off;
index index.html index.htm;
location / {
try_files $uri @em;
}
location @em {
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Real-PORT $remote_port;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header Scheme $scheme;
proxy_set_header Server-Protocol $server_protocol;
proxy_set_header Server-Name $server_name;
proxy_set_header Server-Addr $server_addr;
proxy_set_header Server-Port $server_port;
proxy_pass http://em-laravels;
}
}
参考:https://blog.csdn.net/weixin_45256711/article/details/118527724
|