记录Hexo部署到阿里云服务器踩坑
服务器端接受git上传文件失败,网页显示403 Forbidden
可能的原因:
-
/blog.git/hooks/post-receive中的路径存在错误
-
服务器端放置Hexo静态文件的目录权限问题
此时/home/www/website目录下没有博客文件
解决方案:
$ su git
$ cd /home/www/website
$ ls
# blog.git
$ cd blog.git
$ ls
# branches config description HEAD hooks info objects refs
$ cd hooks/
$ ls
## 在这里可以看到文件夹中有钩子文件post-receive,然后给它最大权限
$ chmod -R 777 post-receive
在本地博客Git Bash处hexo clean && hexo s && hexo d后
再重启nginx服务器即可
$ nginx -s reload
参考博客:https://blog.youkuaiyun.com/WKissa/article/details/80417444