反向代理
配置这个的好处就是端口号本来只能唯一,但是我们通过配置就可以重定向,让我们的非80端口也能使用80端口。
server{listen80;server_name :8081;location / {proxy_pass http://localhost:8081}}
参考:
/weixin_35884835/article/details/52588157
## HTTPS server configuration#server {listen 443;server_name 本机的IP地址;ssl on;ssl_certificate/etc/nginx/server.crt;ssl_certificate_key /etc/nginx/server.key;ssl_session_timeout 5m;# ssl_protocols SSLv2 SSLv3 TLSv1;# ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;# ssl_prefer_server_ciphers on;location / {#root html;#index testssl.html index.html index.htm;proxy_redirect off;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_pass http://IP地址/ssl/;}}
重启nginx,在浏览器输入:https://IP地址 会跳转到 http://IP地址/ssl/ 这个地址(后期调整为webservice接口地址即可)
重启命令 ./nginx -s reload