首页 IT正文

通过IP+端口来访问不同网站

admin IT 2017-04-10 791 0

可以在配置nginx.conf里的http下配置两个server即可: 

server { 
    listen 81; 
    root   /path/to/site1; 
    index index.html index.htm index.php; 
    location ~ \.php$ { 
        try_files $uri =404; 
        include fastcgi_params; 
        fastcgi_pass 127.0.0.1:9000; 
        fastcgi_index index.php; 
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
    } 
}
server { 
    listen 82; 
    root   /path/to/site2; 
    index index.html index.htm index.php; 
    location ~ \.php$ { 
        try_files $uri =404; 
        include fastcgi_params; 
        fastcgi_pass 127.0.0.1:9000; 
        fastcgi_index index.php; 
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
    } 
}

本文转载自网络,侵权删。

本文标题:通过IP+端口来访问不同网站
本文链接:https://xl.cndyun.com/post/59.html
作者授权:除特别说明外,本文由 admin 原创编译并授权 小龙的博客 刊载发布。
版权声明:本文不使用任何协议授权,您可以任何形式自由转载或使用。
«    2024年3月    »
123
45678910
11121314151617
18192021222324
25262728293031

分享:

支付宝

微信