首页 > 其他 > 详细

nginx虚拟主机配置

时间:2017-03-12 00:55:58      阅读:156      评论:0      收藏:0      [点我收藏+]
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目录下

nginx虚拟主机配置

原文:http://www.cnblogs.com/linjiqin/p/6536723.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!