🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
> 使用NGINX作代理,可配置HTTPS以及负载均衡,后期会经常用到 [TOC] ## nginx 配置 ~~~ upstream myserver { ip_hash; server 127.0.0.1:8080; server 127.0.0.1:8090; } server { listen 80; server_name www.test.cc; index index.html index.htm default.htm default.html; location / { proxy_pass http://myserver; client_max_body_size 256m; proxy_set_header Host $http_host:$proxy_port; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_ignore_client_abort on; index index.html index.htm default.html default.htm; } #禁止访问的文件或目录 location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md) { return 404; } #一键申请SSL证书验证目录相关设置 location ~ \.well-known{ allow all; } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ { expires 30d; error_log /dev/null; access_log off; } location ~ .*\.(js|css)?$ { expires 12h; error_log /dev/null; access_log off; } access_log /www/wwwlogs/www.test.cc.log; error_log /www/wwwlogs/www.test.cc.error.log; } ~~~