nginx更改网站主页和构建虚拟机

更改nginxi网站主页

[root@localhost ~]# vim /apps/nginx/conf/nginx.conf

​​​​
在这里插入图片描述
在根目录建立一个ailun目录 添加一个"sumeng"重定向
nginx-s reload
访问192.168.211.100/ailun

[root@localhost data]# mkdir ailun
[root@localhost data]# ls
ailun
[root@localhost data]# echo "sumeng" > ailun/index.html
[root@localhost data]# tree
.
└── ailun
    └── index.html

1 directory, 1 file
[root@localhost data]# curl -L 192.168.211.100/ailun
sumeng

在这里插入图片描述
构建虚拟主机
域名
[root@localhost data]# vim /apps/nginx/conf/nginx.conf
加入
include /apps/nginx/conf.d/*.conf
在这里插入图片描述

[root@localhost nginx]# cd /apps/nginx/conf.d
[root@localhost conf.d]# 
[root@localhost conf.d]# vim ailun.conf
[root@localhost conf.d]# vim sumeng.conf
[root@localhost conf.d]# nginx -t
nginx: the configuration file /apps/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /apps/nginx/conf/nginx.conf test is successful
[root@localhost conf.d]# nginx -s reload
[root@localhost conf.d]# cd /data
[root@localhost data]# mkdir sumeng
[root@localhost data]# ls
ailun  sumeng
[root@localhost data]# echo "sumeng" > sumeng/index.html

server{

listen 80;
server_name www.ailun.com;
root /data/ailun;

}
server{
listen 80;
server_name www.sumeng.com;
root /data/sumeng/;
}
2.端口号
server{
listen 80;
server_name www.ailun.com;
root /data/ailun/;
}
server{
listen 80;
server_name www.sumeng.com;
root /data/ailun/;
}
[root@localhost conf.d]# curl 192.168.211.100:80
sumeng

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值