注意:进行实例之前必须完成nginx的源码编译。(阅读往期文章完成步骤)
1.编辑nginx的配置文件,修改内容
root@localhost \~# vim /usr/local/nginx/conf/nginx.conf


2.创建新目录/usr/local/nginx/conf.d/,编辑新文件vhost.conf
root@localhost \~# mkdir -p /usr/local/nginx/conf.d/
root@localhost \~# vim /usr/local/nginx/conf.d/vhost.conf
server {
listen 80;
server_name www.timinglee.org;
root /data/web/html;
index index.html;
}

root@localhost \~# vim ~/.vimrc
set ts=4 ai sw=4
3.创建网站目录
root@localhost \~# mkdir -p /data/web/html
将内容<www.timinglee.org>输入到网站目录里面
root@localhost \~# echo <www.timinglee.org> > /data/web/html/index.html
程序启动
root@localhost \~# nginx -t
root@localhost \~# nginx -s reload
4.桌面开启解析,在C盘找到到文件

左键属性编辑权限


打开hosts文件,编辑内容。172.25.254.100为虚拟机IP地址

5.浏览器进行访问网站
输入网站www.timinglee.org进行访问
www.timinglee.org

浏览器web站点建立成功