gpt4 book ai didi

windows下Nginx多域名简单配置教程

转载 作者:qq735679552 更新时间:2022-09-29 22:32:09 26 4
gpt4 key购买 nike

CFSDN坚持开源创造价值,我们致力于搭建一个资源共享平台,让每一个IT人在这里找到属于你的精彩世界.

这篇CFSDN的博客文章windows下Nginx多域名简单配置教程由作者收集整理,如果你对这篇文章有兴趣,记得点赞哟.

本文实例为大家分享了Nginx多域名的简单配置教程,供大家参考,具体内容如下 。

1. windows下安装nginx的目录结构如下:

windows下Nginx多域名简单配置教程

2. 在nginx-1.12.1目录下conf/nginx.conf 内容 。

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#user nobody;
worker_processes 1;
events {
   worker_connections 1024;
}
http {
   include    mime.types;
   default_type application /octet-stream ;
   sendfile    on;
   keepalive_timeout 65;
   server {
     listen    80 default_server;
     server_name localhost default_server;
     root  html;
     location / {
       index index.html index.htm;
     }
}
   include .. /vhost/ *.conf;
}

3. vhost 目录下 a_com.conf 内容:

  。

?
1
2
3
4
5
6
7
8
server {
     listen    80;
     server_name www.a.com;
     root  D: /test/ ;
     location / {
       index index.html index.htm;
     }
}

4. vhost 目录下 b_com.conf 内容:

?
1
2
3
4
5
6
7
8
server {
     listen    80;
     server_name www.b.com;
     root  D: /test2/ ;
     location / {
       index index.html index.htm;
     }
}

5. 在本地磁盘D盘下 新建 test 和 test2目录,并新建 index.html文件 。

6. 在本地磁盘C盘中C:\Windows\System32\drivers\etc 下修改hosts 如下 。

?
1
2
127.0.0.1    www.a.com
127.0.0.1    www.b.com

7. 用cmd进入nginx安装目录下执行 。

    nginx.exe  开始    。

    nginx -t  //检测语法 。

    nginx -s reload  //重新启动 。

    nginx -s stop  //停止 。

8. 打开浏览器输入网址 。

github仓库:https://github.com/chengzao 。

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持我.

最后此篇关于windows下Nginx多域名简单配置教程的文章就讲到这里了,如果你想了解更多关于windows下Nginx多域名简单配置教程的内容请搜索CFSDN的文章或继续浏览相关文章,希望大家以后支持我的博客! 。

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com