您的当前位置:首页正文

nginx 在线html,nginx直接访问html的配置

2024-12-12 来源:个人技术集锦

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

}

}

显示全文