nginx 新增域名访问

nginx 新增域名访问

1.申请阿里云域名

2.指向阿里云主机

3.配置nginx文件

server {
    listen 80; 
    server_name zlx.test.com;
    set $root_path /web/;
    location / { 
        root $root_path;
        index index.html index.htm index.php;
        if (!-e $request_filename) {
           # rewrite ^(.*)$ /index.php?s=/$1 last;
        rewrite ^/index.php(.*)$ /index.php?s=$1 last;  
         rewrite ^(.*)$ /index.php?s=$1 last;  

        }   
    }   
    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
        root $root_path;
    }   
View Code

最后测试访问。

zlx.test.com

猜你喜欢

转载自www.cnblogs.com/zoulixiang/p/9441061.html