您的位置:首页 > 运维架构 > Nginx

nginx直接访问html的配置

2015-10-30 18:21 471 查看
写一个 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