0
点赞
收藏
分享

微信扫一扫

002.前端项目发布(Nginx静态网站配置)

kolibreath 2023-02-05 阅读 98

1.在/root目录下增加web文件放置前端静态文件

2.添加配置文件(/etc/nginx/conf.d/)web.conf

server{
listen 80;
# server_name ip;//ip就是公网ip
server_name 域名; //域名

location / {
alias /root/web/; //启动的路径,会初始访问index.html
index index.html;
try_files $uri $uri/ /index.html; //解决页面刷新后空白的问题
}

}

3.重启nginx

nginx -s reload

4.为什么在/etc/nginx/conf.d增加以conf结尾的文件

在/etc/nginx目录下的nginx.conf文件中有这样的代码

include /etc/nginx/conf.d/*.conf;

 



举报

相关推荐

002.预科

002.光纤

002.算法

002. SVN架构

002.网页基本信息

nginx 搭建静态网站

002.时间戳中的时区设置

0 条评论