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;
}
}
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;
}
}
相关文章推荐
- LNMP环境编译安装centos5x/nginx_1.4/mysql_5.6/php_5.4
- Nginx之location详解
- nginx ssl 部分加密
- nginx负载均衡配置
- nginx代理与负载均衡配置
- Nginx 错误汇总
- Nginx学习及实践
- NGINX引入线程池 性能提升9倍
- 手把手教你认识并搭建Nginx
- nginx源码分析—模块及其初始化(二)
- 解决nginx + lua 上传文件问题
- nginx安装和配置
- Linux环境下Nginx安装及Ubuntu Server 15.0.4尝试安装Nginx
- nginx 配置 性能优化
- nginx源码分析—队列结构ngx_queue_t
- nginx源码分析—链表结构ngx_list_t
- nginx web server 不能正确解析css问题
- nginx 正则表达式匹配入门篇 .
- linux下Nginx服务器安装教程
- ubuntu下的nginx+php+mysql配置