nginx直接访问html的配置

时间:2015-10-30 19:01:56   收藏:0   阅读:1022

写一个 x.conf

server {

        listen       80;

#        index  index.html index.htm;

        server_name  html.x.com html.y.net;


    location /rules {

        autoindex on;

        root   /cheyooh;

        index   index.html index.htm;

        # example

        #ModSecurityEnabled on;

        #ModSecurityConfig /etc/nginx/modsecurity.conf;

       }


        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|css|js)$ {

        root /cheyooh/rules;

#        expires 30d;

        }

    }


注:如果直接访问 html.x.com location的根就要这样写:

server {

        listen       80;

#        index  index.html index.htm;

        server_name  html.x.com html.y.net;


    location / {

        autoindex on;

        root   /cheyooh/rules;

        index   index.html index.htm;

        # example

        #ModSecurityEnabled on;

        #ModSecurityConfig /etc/nginx/modsecurity.conf;

       }


        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|css|js)$ {

        root /cheyooh/rules;

#        expires 30d;

        }

    }


原文:http://devin223.blog.51cto.com/10447310/1708159

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!