Java学习—nginx配置反向代理

一、使用nginx反向代理到外网

修改配置文件

Java学习—nginx配置反向代理插图

nginx.conf文件

worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 80; server_name localhost; location / { proxy_pass http://www.xzcit.edu.cn; # root html; #index index.html index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } }

Java学习—nginx配置反向代理插图1

二、反向代理本地服务器

修改nginx.conf文件

worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 80; server_name localhost; location / { proxy_pass http://192.168.200.131; # root html; #index index.html index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } }

Java学习—nginx配置反向代理插图2

原文链接:https://blog.csdn.net/qq_46093575/article/details/124656385

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享