Nginx学习历程_2_配置Nginx的虚拟主机
来源:互联网 发布:王尼玛删视频 知乎 编辑:程序博客网 时间:2024/05/03 01:01
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
[root@web www]
# vim /etc/nginx/nginx.conf
server {
listen 80;
server_name www.nginx.com;
location / {
root
/data/www
;
index index.html index.htm;
}
}
server {
listen 80;
server_name www.
test
.com;
location / {
root
/data/test
;
index index.html index.htm;
}
}
1
2
3
4
[root@web data]
# mkdir test
[root@web data]
# cd test/
[root@web
test
]
# cat index.html
<h1>www.
test
.com<
/h1
>
1
2
3
4
[root@web run]
# service nginx reload
nginx: the configuration
file
/etc/nginx/nginx
.conf syntax is ok
nginx: configuration
file
/etc/nginx/nginx
.conf
test
is successful
重新载入 nginx: [确定]
1
2
3
4
Windows 7下路径:C:\Windows\System32\drivers\etc\hosts
增加两行:
192.168.18.201 www.nginx.com
192.168.18.201 www.
test
.com
访问www.nginx.com ,展示/data/www/index.html
访问www.test.com ,展示/data/test/index.html
0 0
- Nginx学习历程_2_配置Nginx的虚拟主机
- Nginx的虚拟主机配置
- nginx虚拟主机的配置
- Nginx虚拟主机的配置
- 配置Nginx的虚拟主机
- nginx虚拟主机的配置
- Nginx的虚拟主机配置
- nginx虚拟主机的配置
- nginx虚拟主机的配置
- nginx的虚拟主机配置
- Nginx的虚拟主机配置
- nginx虚拟主机的配置
- 4.nginx学习笔记:nginx配置虚拟主机
- Nginx的虚拟主机的配置
- (3)nginx的虚拟主机配置
- Nginx学习历程_5_Nginx对于静态文件的缓存配置
- Nginx 配置虚拟主机
- nginx配置虚拟主机
- JavaScript 数组删除重复项
- 自定义注解+Struts2拦截器实现简单权限控制
- 【数字安全】Security in Java
- 网站缓存技术总结( ehcache memcache redis)
- linux下安装svn,lnmp
- Nginx学习历程_2_配置Nginx的虚拟主机
- Eclipse 的server窗口不能添加tomcat6.0/7.0/8.0等版本的解决方法
- 深入理解JDK动态代理
- 【算法系列】分治法
- 安卓开发的问题
- python
- 03、函数
- 解决for循环闭包取值问题
- 模板引擎 Smarty