1.打开nginx配置文件
/usr/local/webserver/nginx/conf/nginx.conf
2.在http模块下,server模块后加上如下内容
# another virtual host using mix of IP-, name-, and port-based configuration
server {
listen 8000;
server_name localhost;
location / {
root /home/xiaoying/page/game1;
index index.html index.htm;
}
}
3.事先先在上面配置的路径创建或是上传好文件
4.重启nginx服务
/usr/local/webserver/nginx/sbin/nginx -s reload # 重新载入配置文件
5.预览可见
还有一些高级配置项:https://www.runoob.com/linux/nginx-install-setup.html