当前位置: 首页 > news >正文

安徽建设教育协会网站seo狂人

安徽建设教育协会网站,seo狂人,衢州做网站哪家好,深圳市公共资源交易中心官网nginx在绝大数的场景中我们使用其用于做web中间件或反向代理使用,但是nginx实际上也提供了正向代理的功能。下面我们来进行nginx正向代理配置操作,以便大家能够掌握nginx正向代理配置方法。第一步:获取nginx正向代理模块# git clone https://…

nginx在绝大数的场景中我们使用其用于做web中间件或反向代理使用,但是nginx实际上也提供了正向代理的功能。下面我们来进行nginx正向代理配置操作,以便大家能够掌握nginx正向代理配置方法。

第一步:获取nginx正向代理模块

# git clone https://github.com/chobits/ngx_http_proxy_connect_module

第二步:下载nginx源码包

# wget http://nginx.org/download/nginx-1.9.12.tar.gz

# tar xf nginx-1.9.12.tar.gz

第三步:通过补丁方法把上述下载的正向代理模块导入到nginx模块存储目录

# cd nginx-1.9.12/

# patch -p1 < /root/ngx_http_proxy_connect_module/patch/proxy_connect.patch

第四步:编译安装nginx

# yum -y install openssl-devel zlib-devel prce-devel

# ./configure --add-dynamic-module=/root/ngx_http_proxy_connect_module

# make && make install

第五步:配置所允许通过代理主机的主机列表

# cat /usr/local/nginx/conf/client-allow.conf

allow 127.0.0.1;

allow 192.168.216.1;

allow 192.168.216.185;

第六步:修改nginx配置文件

# cat /usr/local/nginx/conf/nginx.conf

#user nobody;

worker_processes 1;

#error_log logs/error.log;

#error_log logs/error.log notice;

#error_log logs/error.log info;

#pid logs/nginx.pid;

load_module /usr/local/nginx/modules/ngx_http_proxy_connect_module.so; #位置注意

events {

worker_connections 1024;

}

http {

include mime.types;

default_type application/octet-stream;

#log_format main '$remote_addr - $remote_user [$time_local] "$request" '

# '$status $body_bytes_sent "$http_referer" '

# '"$http_user_agent" "$http_x_forwarded_for"';

#access_log logs/access.log main;

sendfile on;

#tcp_nopush on;

#keepalive_timeout 0;

keepalive_timeout 65;

#gzip on;

server {

listen 8080; #代理端口

resolver 119.29.29.29; #域名解析服务器

proxy_connect;

proxy_connect_allow 443 563;

proxy_connect_connect_timeout 10s;

proxy_connect_read_timeout 10s;

proxy_connect_send_timeout 10s;

location / {

proxy_pass http://$host;

proxy_set_header Host $host;

}

include client-allow.conf; #主机白名单

deny all; #除了主机白名单中的主机,拒绝所有

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html

#

error_page 500 502 503 504 /50x.html;

location = /50x.html {

root html;

}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80

#

#location ~ .php$ {

# proxy_pass http://127.0.0.1;

#}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

#

#location ~ .php$ {

# root html;

# fastcgi_pass 127.0.0.1:9000;

# fastcgi_index index.php;

# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;

# include fastcgi_params;

#}

# deny access to .htaccess files, if Apache's document root

# concurs with nginx's one

#

#location ~ /.ht {

# deny all;

#}

}

# another virtual host using mix of IP-, name-, and port-based configuration

#

#server {

# listen 8000;

# listen somename:8080;

# server_name somename alias another.alias;

# location / {

# root html;

# index index.html index.htm;

# }

#}

# HTTPS server

#

#server {

# listen 443 ssl;

# server_name localhost;

# ssl_certificate cert.pem;

# ssl_certificate_key cert.key;

# ssl_session_cache shared:SSL:1m;

# ssl_session_timeout 5m;

# ssl_ciphers HIGH:!aNULL:!MD5;

# ssl_prefer_server_ciphers on;

# location / {

# root html;

# index index.html index.htm;

# }

#}

}

第七步:检查并启动nginx服务

# /usr/local/nginx/sbin/nginx -t #检查配置文件

# /usr/local/nginx/sbin/nginx # 启动服务

# /usr/local/nginx/sbin/nginx -s stop #关闭

# /usr/local/nginx/sbin/nginx -s reload #重启加载配置文件

# ss -anput | grep ":8080" #检查端口

第八步:被代理主机配置

bde99b58d229656f8fe09991337ca769.png

ae985fe0ad97308415349377f158eb61.png

f31cb5baffb300dd5f5afae6dda58e74.png

37cc9e509cc1899f072ee2e3a3c8d660.png

第九步:被代理主机验证nginx正向代理可用性

# ss -anput | grep ":8080"

tcp LISTEN 0 128 *:8080 *:* users:(("nginx",pid=19515,fd=6),("nginx",pid=19514,fd=6))

tcp ESTAB 0 0 192.168.216.184:8080 192.168.216.185:35718 users:(("nginx",pid=19515,fd=11))

tcp ESTAB 0 0 192.168.216.184:8080 192.168.216.185:35712 users:(("nginx",pid=19515,fd=3))

原作者:黑马程序员

原平台:黑马程序员官网

原链接:五分钟9步搞定nginx正向代理配置方法

http://www.lbrq.cn/news/2402263.html

相关文章:

  • 网站做框架常州百度搜索优化
  • e通网网站建设运营商大数据精准营销获客
  • 上海最近三天的新闻百度seo关键词点击软件
  • sem可以为网站建设做什么网络seo哈尔滨
  • 大型网站建设报价方案vue seo 优化方案
  • 一个空间开几个网站长尾词排名优化软件
  • 广州网站建设技术重庆百度seo整站优化
  • mac 做网站seo网站推广什么意思
  • 赣州服装网站建设电商培训机构排名
  • 做网站 钱长沙正规seo优化价格
  • 欧阳网站建设营销方法有哪些方式
  • 做响应式网站的框架百度智能建站系统
  • 备案核验单 网站类型google怎么推广
  • 某购物网站建设方案排名优化是怎么做的
  • 网站建设烟台搜索引擎优化是什么工作
  • 宿迁建设公司网站国家免费职业技能培训官网
  • 品牌网鞋有哪些牌子seo搜索引擎优化排名
  • 网站转微信小程序网络推广平台代理
  • 兰州一键建站企业成都网络运营推广
  • 百度移动端网站营销型网站策划
  • 做网站开发用sublime好吗网站优化公司认准乐云seo
  • wordpress 加相关文章百度seo是什么意思呢
  • 哪里可以接做ppt的网站清远新闻最新
  • 挂机宝怎么做网站本周热点新闻事件
  • 自己做网站怎么盈利今日重大国际新闻
  • 昆明网站建设创意b2b电商平台
  • 保定做网站电话抖音怎么推广
  • 万网做网站精准营销的案例
  • 福州网站设计软件公司河南网站推广那家好
  • 网站尾部一般怎么做东莞关键词优化实力乐云seo
  • 苍穹外卖|项目日记(完工总结)
  • nginx定期清理日志
  • 相机模型和对极几何
  • Cosmos:构建下一代互联网的“区块链互联网
  • 商业秘密视域下计算机软件的多重保护困境
  • 学习 Python 爬虫需要哪些基础知识?