Installing wp in sub folder (https-docker-setup)


#1

I’ve been researching on this for exactly 2 complete days now (at this site and also on other sites). For some reason, I couldn’t find what I’m looking for anywhere.

This is my setup:

  1. Site hosted at digitalocean
  2. Site is currently having just the discourse forum (Yes, I prefer having the discourse forum in the homepage)
  3. Site is in HTTPS
  4. Site is running under docker setup
  5. OS: Ubuntu

So, this is what I have.
Everything is working perfectly at this point.
When you open my site, the discourse forum will show up in HTTPS.

What I’m trying to do is this:
Add a WP blog under https://www.mysite.com/blog

Can someone please assist me here?


#2

I think what your looking for is this


(Felix Freiberger) #3

I’m pretty sure that you will have a hard time with that as long as you aren’t willing to move Discourse. For example, links from Discourse to your blog will likely not work, because Discourse will try to route it internally. :frowning:

Things will be a lot easier if you move your Discourse instance to a subdomain.


#4

Yes, I eventually found that link and tried the steps mentioned there.
It works.

BUT, just one thing left to fix now:
http://{site}.com
http://{www.site}.com
https://{site}.com
SHOULD be REDIRECTED to https://{www.site}.com

I tried editing my /etc/nginx/sites-enabled/discourse.conf file - but couldn’t really get it done.
Referred tons of tutorials - but couldn’t still fix it.


(Felix Freiberger) #5

Can you post you domain name so we can have a look at what’s happening now? :slight_smile:


#6

Sorry, the client is not okay with me pasting the URL here.

The real problem with the redirection is this:

There is redirection happening within docker as well as outside docker:

I followed this DOC to do redirection insider docker container

And then again did redirection (outside docker) following this:

As per first doc, I did the redirection using below file:
/var/discourse/containers/app.yml

As per second doc, I did the redirection using below file:
/etc/nginx/sites-enabled/discourse.conf

Am I doing something wrong?
Do we really need to do the redirection at both the places?


#7

I got an idea

I removed the redirection part from the nginx file (outside docker).
Now the redirection will be happening just insider docker.

Rebuilding app is in in progress…
I’ll post here what happens


#8

It worked.
Yayy !!!

So I had to remove the redirection code that was added in the nginx file.
Now the redirection is happening just within the docker container.
And the nginx reverse proxy config routes things to the docker container


(Lutz Biermann) #9

Could you please explain that a little bit more in detail?
Where did you put your php/fpm settings?
What exactly is in the inside and outside nginx container?


(Felix Freiberger) #10

When you think you have it working, try posting a link to the blog (maybe in a message to yourself) and click it. I suspect that you will get a “not found” error (although it will work if you refresh the page).


(Jay Pfaffman) #11

I believe that you need Discourse on a different port and an external web server (ngninx) to reverse proxy to Discourse (and perhaps the other site running Apache).


#12

Summary of what I did so far

  1. Initially, I mean before I started, I had discourse ( at: https://www.{mysite}.com ) running under docker container. I wanted to install WP as well in the same droplet. I knew that installing WP inside the same docker container isn’t practical enough. So, was looking for a way to install WP outside the docker container. After following couple of tutorials I was able to configure reverse proxy using nginx - and now traffic goes to the docker container through the nginx web server installed outside the docker container.

  2. At this point, I would now like to run my WP blog under /blog
    I know that I should be making some changes in the nginx config files.
    But I’m not sure what changes.

I would like to store the WP files under /var/www/html
And the blog should be accessible at https:///www.{site.com}/blog

Anyone know how can this be achieved?


(Jay Pfaffman) #13

If you want WP to be able to control permalinks via .httpaccess, then you want to install Apache on a non-standard port and then reverse proxy to it the same way that you’re reverse proxying to Discourse. You could have Nginx handle php/WordPress directly, but it’s easier to find docs about installing WordPress with Apache and you already know how to configure reverse proxy.

Note that you want at least 2 GB of ram to run WP and Discourse in the same droplet.


#14

lol, so I’m really tired at this point (this is my fourth day on this - I agree I have achieved a lot). But now just the nginx config file needs to be fixed.

I have opened a job for $50 to help me fix my nginx config file