switchHost本地映射
仅限本机使用,外网无法访问。
为啥要用这个:
1、域名比ip好记,
2、环境多了可以自由切换,
通过switchHost工具修改本机host文件,以及本机nginx映射,实现域名访问。
host文件就相当于是DNS解析,将访问的域名解析到ip地址。
switchHost下载地址:https://github.com/oldj/SwitchHosts/releases
本机nginx配置:
在server模块中添加一项配置
| server {listen       80;server_name  *.newland.com;#charset koi8-r;#access_log  logs/host.access.log  main;location / {    root   html;    index  index.html index.htm;    proxy_pass http://192.168.91.159:8099;    proxy_set_header   Host    $host;    proxy_set_header   X-Real-IP   $remote_addr;    proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;    break;} | 
switchHost启动,nginx启动,即可实现通过域名访问wiki。
 
                    
                     
                    
                 
                    
                
 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号