微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

新手快速学会nginx虚拟主机配置的方法

Nginx虚拟主机配置
  server {
  listen 80;
  server_name localhost;
  location / {
  root html;
  index index.html index.htm;
  }
  error_page 404 /404.html;
  # redirect server error pages to the static page /50x.html
  # error_page 500 502 503 504 /50x.html;
  location = /50x.html {
  root html;
  }
  }
  配置说明:
  listen 80; =>指定虚拟主机监听的是80端口
  server_name localhost; =>指定虚拟主机域名
  location / { … } =>匹配请求路径,/表示匹配所有请求百度收录批量查询
  root html; =>指定虚拟主机的物理根目录,eg、html物理根目录位于D:\div\Nginx-1.9.14\html
  index index.html index.htm; =>指定虚拟主机的首页首页位于D:\div\Nginx-1.9.14\html目录下

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐