Nginx实现正向代理实例
作者:雨会停rain
这篇文章主要介绍了Nginx实现正向代理实例,正向代理的作用在于正向代理隐藏了用户,用户的请求被代理服务器接收代替,到了服务器,服务器并不知道用户是谁,需要的朋友可以参考下
1.下载nginx
选择自己需要的版版本下载下来
2.解压文件修改ngixn.conf配置文件
events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 9000; server_name localhost; client_max_body_size 50M; location / { proxy_pass http://172.16.1.3:9000; proxy_set_header X-real-ip $remote_addr; proxy_set_header Host $http_host; proxy_http_version 1.1; proxy_set_header Connection ""; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } }
3.点击nginx.exe启动
- 或者打开nginx的目录输入cmd回车
- 输入start nginx
4.常用命令
windows
- 服务启动
linux根据配置文件启动 ./nginx -c /usr/local/nginx/conf/nginx.conf window在cmd中启动 start nginx
- 服务停止
#立即停止 nginx -s stop 或者 平滑停止 nginx -s quit
- 服务重启
nginx -s reload
linux
- 启动 Nginx
./nginx
- 停止 Nginx
./nginx -s stop
- 安全退出 Nginx
./nginx -s quit
- 重新加载 Nginx 配置文件
./nginx -s reload
- 查看 Nginx 进程
ps aux|grep nginx
到此这篇关于Nginx实现正向代理实例的文章就介绍到这了,更多相关Nginx正向代理内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!