🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
[TOC] # 修改nginx配置文件 在 `/etc/nginx/conf.d` 目录添加文件 `test-surahe-com-3000.conf` ~~~ upstream test { server 127.0.0.1:3000; } server { listen 80; server_name test.surahe.com; location / { proxy_pass http://test; # 获取用户IP proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # 错误页 proxy_intercept_errors on; error_page 404 https://www.baidu.com; # 不缓存包含在field的响应header proxy_ignore_headers Set-Cookie Cache-Control Expires; proxy_hide_header Cache-Control; proxy_hide_header Set-Cookie; proxy_hide_header Expires; } } ~~~ 修改后重启nginx ~~~ service nginx restart ~~~ <br> ## 修改防火墙 ~~~ vi /etc/sysconfig/iptables ~~~ ~~~ # test.surahe.com -A INPUT -s 127.0.0.1 -p tcp --destination-port 3000 -m state --state NEW,ESTABLISHED -j ACCEPT -A OUTPUT -d 127.0.0.1 -p tcp --source-port 3000 -m state --state ESTABLISHED -j ACCEPT ~~~ <br> ## 修改静态资源访问 ~~~ location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|js|pdf|txt) { root /www/test/production/current/public } ~~~