首页 > 其他 > 详细

Nginx set指令

时间:2021-08-19 08:31:31      阅读:21      评论:0      收藏:0      [点我收藏+]

nginx set指令

[root@localhost conf.d]# vim /etc/nginx/conf.d/rewrite.conf
server {
        listen 80;
        server_name www.rewrite.com rewrite.com;
        access_log /var/log/nginx/test2-access.log main;
        error_log /var/log/nginx/test2-error.log;
        location /{
                root /html/rewrite;
                index index.html index.htm index.php;
                if ($host ~* "^www.rewrite.com$|^rewrite.com$" ) {
                        break;
                }
                if ($host ~* "^(.*)\.rewrite\.com$" ) {
                        set $user $1;
                        rewrite .* http://www.rewrite.com/$user permanent;
                }
        }

        location /one{
                root /html/rewrite;
                index index.html index.htm index.php;
        }
        location /two{
                root /html/rewrite;
                index index.html index.htm index.php;
        }
        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
        root /var/www/test;
        }
}

[root@localhost conf.d]# tree /html
/html
└── rewrite
    ├── index.html
    ├── one
    │   └── index.html
    └── two
        └── index.html

Nginx set指令

原文:https://www.cnblogs.com/BrokenEaves/p/15159408.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!