Nginx 虚拟机怎么安装和使用
发表于:2024-10-26 作者:千家信息网编辑
千家信息网最后更新 2024年10月26日,这篇文章主要介绍Nginx 虚拟机怎么安装和使用,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!在Nginx 虚拟机中用多个子域名,每个子域名到不同的目录。如:http {
千家信息网最后更新 2024年10月26日Nginx 虚拟机怎么安装和使用
这篇文章主要介绍Nginx 虚拟机怎么安装和使用,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!
在Nginx 虚拟机中用多个子域名,每个子域名到不同的目录。
如:
http { server { listen 80; server_name a.chenlb.com; access_log logs/a.access.log main; server_name_in_redirect off; location / { index index.html; root /home/www/host_a/; } } server { listen 80; server_name b.chenlb.com; access_log logs/b.access.log main; server_name_in_redirect off; location / { index index.html; root /home/www/host_b/; } } } http { server { listen 80; server_name a.chenlb.com; access_log logs/a.access.log main; server_name_in_redirect off; location / { index index.html; root /home/www/host_a/; } } server { listen 80; server_name b.chenlb.com; access_log logs/b.access.log main; server_name_in_redirect off; location / { index index.html; root /home/www/host_b/; } } }
结果发现用 b.chenlb.com 还是指到 host_a 目录。后来看了官方示例:http://wiki.Nginx.org/NginxVirtualHostExample,提到有个 default 的匹配,如:
http { server { listen 80 default; server_name _; access_log logs/default.access.log main; server_name_in_redirect off; location / { index index.html; root /var/www/default/htdocs; } } } http { server { listen 80 default; server_name _; access_log logs/default.access.log main; server_name_in_redirect off; location / { index index.html; root /var/www/default/htdocs; } } }
加上这个 default 就可使 a.chenlb.com 和 b.chenlb.com 正常工作了。
以上是"Nginx 虚拟机怎么安装和使用"这篇文章的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注行业资讯频道!
内容
目录
篇文章
不同
个子
中用
价值
兴趣
域名
多个
官方
小伙
小伙伴
更多
知识
示例
结果
行业
资讯
资讯频道
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
diy服务器电脑
中学网络安全月总结报告
服务器机架怎么安装
网约车软件开发资质
pubg在哪儿换服务器
网络安全谁建设
1600核服务器
河南省信息网络安全公司官网
ucsc数据库的使用方法
服务器设置系统安全
软件开发的转正工作总结
阿里云服务器安全组配置
电力网络安全事件案例
软件开发的过程活动
大学生做后台数据库
网络安全 公需科目
网络安全风险评估1级
服务器hdd不用风扇会坏吗
杭州电子科技大学工业互联网
迈瑞软件开发待遇
深圳麦开网络技术
数据库多实例归档空间共用吗
南京一六八八网络技术
ENSCO数据库子库
医学网络技术就业方向
武汉唐济 电子软件开发
上海博远网络技术有限公司
网络安全法实施条例第四十二条
从数据库获取session
网络安全600字作文5年级