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 but the problem is that the hexo blog redirects it to Now, I know why it’s happening, its because of the blog config that I set up as:


## If your site is put in a subdirectory, set url as '' and root as '/child/'
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 {

    root /www/data/blog/public;
    index index.html index.htm;

        location /

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/; # 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

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


Try DigitalOcean for free

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

Sign up

Featured on Community

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