更改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