Report this

What is the reason for this report?

Setting up another location besides Ghost

Posted on February 6, 2021

I don’t have much experience with Nginx so I’m just trying to figure this out, please bare with me.

I setup a droplet with Ghost and setup up under http://domain.com/blog, however I want to setup a static page under http://domain.com/ which is going just be a simple html site. I’m not too sure how to go about doing this. I’ve done some research and some googling and can’t get it to work.

Any advice and tips would be really helpful, thanks!



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!

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.

Heya,

To set up a static page at the root domain while having Ghost running under /blog, you’ll need to modify the Nginx configuration.

Follow these steps:

  1. Upload your static site files to a directory in your droplet. For example: /var/www/html.
  2. Open the Nginx configuration file for your Ghost installation. This is usually located at /etc/nginx/sites-available/your_domain.
  3. Edit the configuration to include a new location block for the root path. Modify it like this:
  1. server {
  2. ...
  3. location / {
  4. root /var/www/html;
  5. try_files $uri $uri/ =404;
  6. }
  7. ...
  8. }

Make sure to replace /var/www/html with the path to your static files directory. Save the changes and exit.

Finally, restart Nginx to apply the changes:

  1. sudo systemctl restart nginx

Your static page should now be accessible at the root domain, while the Ghost blog will remain under /blog.

For more information on Nginx configurations, you can refer to the DigitalOcean Nginx Server Blocks tutorial.

Hope that this helps!

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.