ddddddf 发表于 2018-11-17 06:06:39

nginx直接访问html的配置

  写一个 x.conf
  server {
  listen       80;
  #      indexindex.html index.htm;
  server_namehtml.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;
  #      indexindex.html index.htm;
  server_namehtml.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;
  }
  }

页: [1]
查看完整版本: nginx直接访问html的配置