【发布时间】:2018-08-17 12:02:33
【问题描述】:
我需要帮助在我的 droplet 上设置博客。我已经在 blog.mysite.io 上使用 Hexo 成功部署了博客,但问题是 hexo 博客将其重定向到 blog.mysite.io/blog/public。现在,我知道为什么会这样了,这是因为我设置的博客配置:
_config.yml
# URL
## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
url: http://blog.mysite.io/
root: /blog/public
permalink: :year/:month/:day/:title/
我的博客位于 /www/data/blog。我将根目录设置为 /blog/public 的原因是,如果我不这样做,css 和其他所有内容都会中断。博客运行良好,但只有 HTML 部分。
这是 nginx vhosts.conf 配置:
server {
server_name blog.mysite.io;
root /www/data/blog/public;
index index.html index.htm;
location /
{
proxy_pass http://127.0.0.1:4000;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/blog.mysite.io/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/blog.mysite.io/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
除上述设置之外的任何其他设置都会导致网站完全中断或路径不匹配。 那么,如何直接在 blog.mysite.io 上提供我的网站?
【问题讨论】:
标签: node.js nginx deployment nginx-reverse-proxy hexo