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