Linux服务器配置nginx访问静态网页
配置nginx
打开conf文件进行编辑:
sudo nano /etc/nginx/nginx.conf
在http块内添加:
server { listen 80; server_name xxx.your_domain.com; root /root/work/your_web_folder; index index.html; }
重启nginx:
sudo service nginx restart
如果访问时出现403错误,请设置权限后再重启nginx:
sudo chmod -R 777 /root
sudo chmod -R 777 /root/work/
sudo chmod -R 777 /root/work/your_web_folder
参考:
https://www.linuxprobe.com/nginx-403-forbidden.html
https://mincong.io/cn/nginx-subdomains/