Is there a way to setup a reverse proxy to an NGINX Wordpress site with Ghost droplet (NGINX > NGINX)

July 6, 2019 309 views
Nginx WordPress Apache Ghost DigitalOcean Articles

Hey guys, I’m tasked with getting an NGINX ran Wordpress site and a Ghost droplet (1click) working with a reverse proxy on the ghost droplet. Honestly I’m not sure how the heck to go about it because everything I’ve tried has stopped midway.

Here’s the setup:
Site 1 - the wordpress site) www.site.com
Site 2 - the ghost site) www.site.com/blog

Note: They’re both on NGINX (there’s not a lot of ngnix to nginx documenation out there which makes me wonder if this is where I’m messing up)

With ghost install giving me issues when doing a reverse proxy, I was planning on giving ghost a manual install after I got the reverse proxy setup.

Now I’ve followed the guide on How To Configure Nginx as a Web Server and Reverse Proxy for Apache on One Ubuntu 18.04 Server but I can never get the foobar.com and test.io up and running.

Has anyone done what I’m trying to do? Is there documentation out there on how to do it because I am legitimately stumped on why I can’t get this working.

I am quite new, and I hope this is enough information.

Thank you in advance for the help, and your patience with my lack of understanding

1 Answer

Hello,

You could indeed just use a reverse proxy to do that. It’s not a problem that both servers are Nginx.

So in your server block for your wordpress droplet you could add something like this:

location ~/blog(.*)$ {
    proxy_set_header X-Real-IP  $remote_addr;
    proxy_set_header X-Forwarded-For $remote_addr;
    proxy_set_header Host $host;
    proxy_pass http://your_ghost_droplet.com:80$1;
}

Hope that this helps!
Bobby

Have another answer? Share your knowledge.