Question

Can't figure out how to set up Hexo and NGINX Vhosts config.

Hello everyone, I need help setting up a blog on my droplet. I have successfully deployed the blog using Hexo at blog.mysite.io but the problem is that the hexo blog redirects it to blog.mysite.io/blog/public. Now, I know why it’s happening, its because of the blog config that I set up as:

_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/

My blog is in /www/data/blog. The reason why I set up the root directory as /blog/public is, the css and everything else break if I don’t. The blog runs fine but only the HTML part.

Here’s the nginx **vhosts.conf **configuration:

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

}

Anything other than the setting above results in either breaking the site altogether or mismatched paths. So, how can I serve my website directly at blog.mysite.io?

Show comments

Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Accepted Answer

SOLVED

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel