版权声明:凭栏处,潇潇雨歇。 https://blog.csdn.net/IndexMan/article/details/84668668
1.修改配置文件
vim /usr/local/nginx/conf/nginx.conf
添加一个server节点:
server {
listen 81;
server_name localhost;
access_log logs/test.log;
location / {
index index.html;
root html/test;
}
}
2.创建站点目录
cd /usr/local/nginx/html/
mkdir test
cd test
vim index.html
网页内容如下:
<h1>Hello Nginx!</h1>
3.重载配置
cd /usr/local/nginx/sbin/
./nginx -s reload
4.访问查看效果
我这个是虚拟机的Ip
http://192.168.43.139:81