当前位置:首页 > 服务器日常问题 > IIS配置经验 > 正文内容

nginx反代(反向代理)设置教程

xmwl2年前 (2022-07-09)IIS配置经验704
编辑nginx配置文件,nginx.conf,可以用记事本直接打开。
将默认的
    server {
        listen       80;
        server_name  localhost;
        #charset koi8-r;
        #access_log  logs/host.access.log  main;
        location / {
            root   html;
            index  index.html index.htm;
        }


修改为:
    server {
        listen       80; 
        server_name  www.domain.com;  #反代的域名
        #charset koi8-r;
        #access_log  logs/host.access.log  main;
        location / {
          proxy_pass  http://192.168.1.2:800;  #目标服务器IP和端口
          proxy_set_header Host $http_host;    #目标服务器主机头server_name
       proxy_set_header X-Forward-For $remote_addr;           
       index  index.html index.htm;
        }


版权声明:
本站资源和文章内容大部分收集于网络,
本站所有资源的版权均属于原作者所有,
本站资源只用于参考学习,请勿直接商用,
若由于商用引起版权纠纷,一切责任均由使用者承担。
若有侵权之处请联系站长我们会第一时间删除

本文由XM技术学习分享发布,如需转载请注明出处。

本文链接:http://xmwl.cc/iis/97.html

标签: IIS配置经验
分享给朋友: