Can a static website work with Ghost as a subdirectory

If you’re looking for some help, it’s important to provide as much context as possible so that people are able to assist you. Try to always mention:

  • What’s your URL? This is the easiest way for others to debug your issue www.mmag.org
  • What version of Ghost are you using? v2.03
  • What configuration? nginx, ubuntu, msql and let encrypt
  • What browser?
  • What errors or information do you see in the console? cant see the ghost admin page after installation is successful
  • What steps could someone else take to reproduce the issue you’re having? type www.mmag.org click on blog. I want to make this page within mmag.org the ghost blog. How can i accomplish this? Is there a guide you can follow step by step.

Sure, You can do this.

Setup a Ghost blog in blog subdirectory. Install instructions are available here.
https://docs.ghost.org/docs/install

Ghost-cli will automatically update Nginx and let encrypt

thank You for the speedy response. I am have an issue with the sever block I get an error message 502 bad gatewway NGINX. So I looked into the server block to show the /blog ( subdirectory) I still get the error message, 502 bad.

Would you have documentation how to configure the server block with digital ocean?

There isn’t explicit documentation for configuring NGINX in Ghost 1.x / 2.x, since it’s handled by the CLI. You can see the templates used by the cli in the source code

I asked and you delivered… I should have said that I am new to LEMP but what are should I focus on to remove the 502 bad error ? Is nginx.conf to focus on correct . If so do I also change the location to mmag.org/blog?
or just /blog?

Looks like this topic may help you. Ghost as a sub directory using NGINX

Thank you for the tip! Attempted two ways installed ghost in www/ghost and 404 page not found.
Then installed ghost in the root/www/mainsite/ghost. Ghost installed successfully. its still not found
url: mmag.org/blog

In the sever block > etc/nginx/sites-enabled:

Will you try one thing? Just start from beginning.

  1. Remove all your ghost installation.
  2. cd into /var/www/
  3. Create a folder named “blog”
  4. cd into that folder
  5. run ghost install
  6. When it prompts “enter your blog URL” then type https://mmag.org/blog/ ( as your site is on https )
  7. finish the installation process
  8. Then visit https://mmag.org/blog/

See if it works or not.

Same error message 38%20PM

Your nginx config doesn’t reflect what you’re trying to do :grimacing:

Given http://mmag.org redirects to https://mmag.org, the second image you posted regarding your config isn’t applicable. Moreover, the server_name localhost means that applies to http://localhost, not your site. Try posting the location /blog {...} part that’s in your second screen shot after the location / {...} part of your first screenshot.

Thank you for the guidance so after GBJ solution: this is how the file default shows now 20%20PM 12%20PM

Just wanted to make sure I am going in the right direction.

Vikaspotluri 123 good eye but this a first so not the page is still coming up as not found. Question I do have an htlm page name blog from the menu bar. Do you think that this may interfere with the page loading? Thank you for your time and its really appreciated.

I’m not entirely sure, since I’m not super well versed in how location hiererarchy works in nginx.

Looking at the new config you posted, it’s still not correct.

listen 80 is for http requests, and listen 443 is for https requests. In one of your blocks, you’re telling nginx to redirect all requests that use http to https. What this means is you shouldn’t be putting any logical routing in any server blocks with listen 80.

If you move the location ^~ /blog block to your https block and restart, that should work

The subdirectory is working now.THANK YOU Vikaspoltluri and GBJ Solution also Rohitkrops :clap::muscle::muscle::muscle:

Hierarchy of the menu does not matter. Such a newbie. LOL

I did on more thing the subfolder did not have the right permission but Its clearly the server block you mentioned that was incorrect. 17%20PM 30%20PM

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.