linuxserver / reverse-proxy-confs

These confs are pulled into our SWAG image: https://github.com/linuxserver/docker-swag
GNU General Public License v3.0
1.33k stars 299 forks source link

Wordpress proxy-conf missing #93

Closed marshalleq closed 4 years ago

marshalleq commented 4 years ago

I've been trying to find some good standard wordpress configs for a while, somewhat in disbelief that it didn't exist in the proxy-confs already, given how popular wordpress is. Then following this old guide here, I notice it did seem to get included previously.

I'm not sure if it was removed intentionally, but it would be great if it could be re-added?

Many thanks,

Marshalleq

tobbenb commented 4 years ago

Where in that guide does it say it's included? The site conf for WordPress is probably made by @GilbN (or he stole it from the internets).

marshalleq commented 4 years ago

Where in that guide does it say it's included? The site conf for WordPress is probably made by @gilbN (or he stole it from the internets).

I could be wrong, but nevertheless, there does not appear to be a proxy-conf in the templates.

nemchik commented 4 years ago

Gil's article provides instructions to run WordPress as a site via the letsencrypt container. Doing so isn't proxying WordPress. As such a proxy config wouldn't actually fit by the name of this repo.

WordPress is obviously popular and could be run in a separate container and that container could be proxied, but there's a lot more than just a proxy config needed to get that setup. The official docker maintained WordPress image isn't very clear about how to handle persistent storage (from a documentation perspective) and encouraging that option would likely result in increased support queries for lsio.

Gil's guide is quite appropriate for what you need, and following it should get you where you want to be.

marshalleq commented 4 years ago

Thanks, I had to consider your comments for a moment and see your point.

It's confusing as on unraid most people now use a container called letsencrypt, which includes NGINX with proxy enabled and copy of the nginx templates. This is the setup I'm running now.

So I already have a lot of other dockers, with a running implementation of letsencrypt and nginx and I do need to proxy this as I do not have the luxury of multiple registered IP addresses.

I believe I just need a working proxy config for wordpress to finish my setup. I've seen others say they've gotten theirs working, but I'm finding it quite hard to figure out how to do it - which of course may be your point.

Thanks.

Edit for clarity - So to your point, the part I was confused about was that the guide was using NGINX as a web server only and I was thinking it was using NGINX to proxy to e.g. Apache.

To this end, it would be so much easier if wordpress could have a template included. I will be trying to understand how NGINX proxy works in the interim of course.

nemchik commented 4 years ago

https://gist.github.com/nemchik/5af129eec09b2f716aed5770fd9eb553 this should help. It's not a proxy config, it's a site config. It may not be complete. Off the top of my head you may need something to handle pretty permalinks, and Gil's article mentions a few more configs you might want/need.

P.s. I haven't tested this at all. The rest of Gil's guide about setting to mariadb and whatnot is still needed as well.

aptalca commented 4 years ago

@marshalleq you can host wordpress directly in the letsencrypt container. See here: https://blog.linuxserver.io/2019/04/25/letsencrypt-nginx-starter-guide/#hostingawordpresssite

marshalleq commented 4 years ago

Thanks again guys. I'll check out the link from @nemchik first, then the link from @aptalca however I had considered hosting it in the let's encrypt container, but decided that's a last resort as I feel it's safer / better to separate it out like my other dockers. Are you both saying having a proxy setup is not recommended? I would have thought it's quite advantageous. Thanks.

nemchik commented 4 years ago

Running WordPress within the letsencrypt container will be more straightforward than separating it into another container.

marshalleq commented 4 years ago

Yes, but as I've eluded that's not what I'm asking for. For quite a number of reasons, I don't want to fudge that container unless I have to. It's a last resort. I think it would be quite a horrible design and fraught with potential issues.

nemchik commented 4 years ago

The nature of containers is to be easily replaced if fudged, and the letsencrypt container was designed with the ability to run WordPress (and other things) in mind, not just proxies.

If you insist on running WordPress separately you could grab the lsio nginx container and setup WordPress to run from it and then proxy that container using letsencrypt. You'll still be doing an nginx config quite similar to what I posted above. You'll be adding an extra layer of complexity (more breakpoints) to your setup. And you won't be gaining anything other than maybe some piece of mind about keeping things separated (which, to my points above is unnecessary).

There are other ways to run WordPress separately as well, but I'm not going to go through every option I can think of when you've been given a well documented solution already.

Please consider trying what we've recommended. You really won't even be modifying anything about the configs in the letsencrypt container, just adding an extra site config which is easily removed if you feel it's fudged your setup.

marshalleq commented 4 years ago

Thanks, I have definitely considered what has been said, and I am taking this advice as simply that, a fellow colleague trying to help another out - which is what I would do. I do think that these opinions are taking us away from the topic though, which was just a bug report / feature request.

But to address your other comments..

'If I insist to run word press separately I could grab an nginx container' Seriously? I don't know what background you come from, but in mine it's never recommended to dump a whole lot of production services in a single place of failure like this. In fact that's the whole point of why we have docker and container orchestration / automation. Also in case there is some misunderstanding - I already run wordpress in a container. I also run it at a separate hosting provider.

'I'll be adding more breakpoints' - I think that's arguable, but with running separate dockers and if a single container does break - it won't bring everything else down with it.

'I've been given a well documented solution already'. There are a lot of well documented solutions out there for different requirements, but you seem to have decided to just give me your one solution as the only right one. For me it's not my preferred one which is the whole point of opening this ticket and making this specific request. It seems like nobody wants to actually talk about that. Finally to leave on a positive note, I do appreciate all the thoughts you've brought to the table and I'm currently working through the proxy-conf guides so I can learn better how to configure it. I've just never had to before because there were templates.

Many thanks for your time.

nemchik commented 4 years ago

If you've already got WordPress in another container you can simply copy one of the existing proxies and replace all instances of the app name with the container name that you're running WordPress in. Ex: if the container name is mywebserver you can grab https://github.com/linuxserver/reverse-proxy-confs/blob/master/adguard.subdomain.conf.sample and rename it accordingly and replace the word adguard with mywebserver across the whole file. Ensure your container and the letsencrypt container are on the same user defined bridge network. You should then have a working https://mywebserver.mydomain.com proxy.

One reason this isn't included by default is there's a lot of different ways you could setup WordPress (as I mentioned above) and there's not a decent way to make a one size fits all (or most) proxy.

If you need additional help getting the kind of proxy I'm describing here setup please come visit the lsio discord https://discord.gg/YWrKVTn since like you said we're getting a bit off topic with the bug/feature request. I'd be happy to help you complete the setup.

Lsio may decide to keep this issue open if someone believes a one size fits most proxy could be included.

marshalleq commented 4 years ago

Great thanks. Yes that's where my head is at. But under the assumption e.g. adguard config wouldn't work for wordpress - it hasn't so far / hence the ticket. Didn't know there was a discord channel - many thanks for that, that will help a lot!

Oh it's just linuxserver.io discord - I'm even already on that ;)

Marshalleq

marshalleq commented 4 years ago

Hi so I used a standard nginx config (took it from the Tautulli one) and it's working. However it does seem that there are a few extra things I'm going to need to pass through. I haven't yet figured out what they are, but the API doesn't seem to be working for a start.

I do recall seeing somewhere on the web a special config was needed for the API to pass through, which I'm trying to find, so far unsuccessfully.

Anyway, this is just an update to let you know it works sort of and I suspect some extra config will be required. When I learn any of what that is, I'll post it here.

Screen Shot 2019-10-31 at 09 38 04
marshalleq commented 4 years ago

The fix for the above issue was to remove $server_port from the proxy_set_header Host $host:$server_port; line within proxy.conf. This found by iXNyNe on discord. Removing this appears to have had zero impact on my other dockers so I'd question why it needs to be on at all.

I'm currently investigating the proxy_cache within nginx, as it is most likely to have extreme benefit for wordpress, but it currently produces an error which I suspect means a module is not currently baked into the letsencrypt container. Will post back when I know more.

aptalca commented 4 years ago

That was already removed from the defaults. It's on the letsencrypt changelog

adamradocz commented 4 years ago

This wordpress handbook shows some php extensions that aren't included in the docker. Could you add those?

marshalleq commented 4 years ago

Thanks, I guess I had an older config.

nemchik commented 4 years ago

This seems to be resolved.