1.修改配置文件
vim/usr/local/nginx/conf/nginx.conf
添加一个server节点:
server{
listen81;
server_namelocalhost;
access_loglogs/test.log;
location/{
indexindex.html;
roothtml/test;
}
}
2.创建站点目录
cd/usr/local/nginx/html/
mkdirtest
cdtest
vimindex.html
网页内容如下:
<h1>HelloNginx!</h1>
3.重载配置
cd/usr/local/nginx/sbin/
./nginx-sreload
4.访问查看效果
我这个是虚拟机的Ip
http://192.168.43.139:81