企业级Ngnix基于域名的配置_server
2023-09-11 14:20:11 时间
普通的nginx配置
egrep -v "#|^$" /usr/local/nginx/conf/nginx.conf.default
更改nginx的配置文件-->注意空格和封号
cp /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/nginx.conf.bak vim /usr/local/nginx/conf/nginx.conf worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 80; server_name www.baobaotao.com; location / { root html/baobaotao; index index.html index.htm; } } server { listen 80; server_name www.etiantian.com; location / { root html/bbs; index index.html index.htm; } } server { listen 88; server_name www.blog.com; location / { root html/blog; index index.html index.htm; } } }
创建虚拟站点目录
mkdir -p /usr/local/nginx/html/baobaotao mkdir -p /usr/local/nginx/html/etiantian mkdir -p /usr/local/nginx/html/blog echo "www.baobaotao.com" > /usr/local/nginx/html/baobaotao/inhtml echo "www.etiantian.com" > /usr/local/nginx/html/etiantian/index.html echo "www.blog.com" > /usr/local/nginx/html/blog/index.html
检查配置,重启服务
cd /usr/local/nginx/sbin ./nginx -t 【测试ok后重启服务,-t 表示测试】
./nginx -s reload 【测试ok,重启服务】
配置hosts
echo "192.168.25.144 www.baobaotao.com" >> /etc/hosts echo "192.168.25.144 www.etiantian.com" >> /etc/hosts echo "192.168.25.144 www.blog.com" >> /etc/hosts tail /etc/hosts
说明:blog设置的是88端口
相关文章
- ASP.NET 4.5.256 has not been registered on the Web server
- Is there any hot reload for blazor server-side?
- SQL Server - Management Studio - Client Statistics - Wait time on server replies vs Client processing time
- 请教server专家:在server 2012 R2标准版系统中激活RDS服务5用户许可后,当前只能2用户同时在线
- ubuntu server samba服务器配置
- SQL SERVER错误:已超过了锁请求超时时段。 (Microsoft SQL Server,错误: 1222)
- TCP/UDP网络编程入门教程之二:TCP Server端——socket与文件描述符
- 《Windows Server 2012活动目录管理实践》——1.3 常用的计算机概念
- sql server 小技巧(3) SQL Server 2012 数据库完整导出到SQL Azure (包括数据)
- Ubuntu Server无桌面无显示器情况下虚拟屏幕xvfb的安装及设置—ubuntu18.04server服务器系统下为python安装虚拟显示器 (使用jupyter notebook在web端播放openai的gym下保存的运行视频——需安装ipython)
- sql server注入执行命令
- 解决问题 “You don't have permission to access /index.html on this server.”
- nginx server中的server_name配置的域名在客户机上无法访问
- sql server作业报错:从ICassFactory为CLSID为{17BCA6E8-A950-497E-B2F9-AF6AA475916F}的COM组件创建实例失败,原因是出现以下错误:c001f011.(Microsoft.Server.manageDTS)
- 最小配置启动SQL SERVER,更改SQL Server最大内存大小导致不能启动的解决方法
- 【sql server镜像】SQL SERVER 基于数据库镜像的主从同步(数据库镜像实践汇总)