nginx把非一级域名转发到域名

来源:互联网 发布:什么叫数据库开发 编辑:程序博客网 时间:2024/06/05 05:13


把所有二级域名转发到 一级域名


server { listen 80;      #listen [::]:80;      server_name  *.hapu.net;      rewrite ^(.*) http://hapu.net/$1 permanent;}server{        listen 80;        #listen [::]:80;        server_name hapu.net;        index index.html index.htm index.php default.html default.htm default.php;        root  /home/wwwroot/hapu.net;        include none.conf;        #error_page   404   /404.html;        include enable-php.conf;        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$        {            expires      30d;        }        location ~ .*\.(js|css)?$        {            expires      12h;        }        location ~ /\.        {            deny all;        }        access_log off;}    


原创粉丝点击