這是在一台阿里雲服務器沒有任何域名,但是配置高,因此想借用另一台阿里雲服務器(配置較低)已備案的域名 跳轉到這台配置高的服務器,那么使用nginx反向代理
server { listen 80; server_name wxapi.exampile.com; //另一台阿里雲服務器已備案的域名 root /home/soft/dist; # Load configuration files for the default server block. include /etc/nginx/default.d/*.conf; location / { } location /api { proxy_pass http://427.125.114.42:8888; //本台服務所運行的程序地址 } location /login{ proxy_pass http://427.125.124.412:8888; } location /xcx { proxy_pass http://427.122.104.412:8888; } error_page 404 /404.html; location = /40x.html { } error_page 500 502 503 504 /50x.html; location = /50x.html { } }
配置低的阿里雲服務器配置:
參考一下:https://blog.csdn.net/visiontime/article/details/70880388