首页 > Web开发 > 详细

nginx直接访问html的配置

时间:2015-10-30 19:01:56      阅读:1022      评论:0      收藏:0      [点我收藏+]

写一个 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;

        }

    }


nginx直接访问html的配置

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

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