码迷,mamicode.com
首页 > Web开发 > 详细

nginx直接访问html的配置

时间:2015-10-30 19:03:12      阅读:993      评论:0      收藏:0      [点我收藏+]

标签:nginx直接访问html

写一个 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的配置

标签:nginx直接访问html

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!