Hosting a WordPress website

Currently reading
Hosting a WordPress website

Have you done any links between those too containers?
Yes, in wordpress container I have this link:
link.PNG

Also if you log into the Terminal tab of WP and open up bash, can you ping the sql container using its name?
I am honestly not familiar with this.
In the terminal of wordpress container I did Create>Launch with command>/bin/bash.
Apart from the fact that I keep receiving messages like "Socket closed." and I need to restart, I am trying to ping the database from there by using the command exec ... ping ... but I don't know which IP address/name I should write there to make it work.
 
Removed the alias and left the environment variables manually added in the wordpress container (WORDPRESS_DB_HOST, WORDPRESS_DB_NAME, WORDPRESS_DB_USER, WORDPRESS_DB_PASSWORD) but still getting error in establishing a database connection.
 
Removed the alias and left the environment variables manually added in the wordpress container (WORDPRESS_DB_HOST, WORDPRESS_DB_NAME, WORDPRESS_DB_USER, WORDPRESS_DB_PASSWORD) but still getting error in establishing a database connection.
Any special firewall rule on syno side? have you open docker subnet ranger to have access to the lan subnet?
 
That was the problem!
These were my settings:
firewall.PNG

I temporarely added a rule allowing all from Source IP 172.17.0.0 (Docker default). Is it correct like this or should I allow only port 3306, or do it via reverse proxy?
 
That was the problem!
These were my settings:
View attachment 3665
I temporarely added a rule allowing all from Source IP 172.17.0.0 (Docker default). Is it correct like this or should I allow only port 3306, or do it via reverse proxy?
Great. leave all ports for that subnet do you don’t fight the ports all over again.

Now continue forward and push WP over reverse
 
What kind of error do you get?

Do you have port 80 open on your router and pointing to your NAS? Also, why port 80/HTTP? Wouldnt it be better to run it on 443/HTTPS with a valid certificate?
 
The error is "Synology Sorry, the page you are looking for is not found".

Port 80 is open in the Router and pointing to the NAS. I'm actually using Port 80 since it is the one which was used in the tutorial. Should I substitute it with Port 443? Or using both?
 
The error is "Synology Sorry, the page you are looking for is not found".
Try and edit your RP entry like this:

Source:
  • Protocol: HTTP
  • Hostname: wp.mydomain.com
  • Port: 80
Destination:
  • Protocol: HTTP
  • Hostname: nasip
  • Port: 32789
The error you get means that the RP did its job but the redirect was wrong, as in, it targeted the non-existing destination. Ofc, be sure to make a new DNS record that will reflect on your new source hostname: wp.xxxx.xxx
 
  • Hostname: wp.mydomain.com
But like this the website would be reachable at wp.mydomain.com, correct?
I want it to be reachable at mydomain.com, how should I do?

Anyway, I tried to change the RP like you suggested, added a CNAME record but I could not reach the website at http://wp.mydomain.com (after a while it changes y itself to https://wp.mydomain.com:XXXX where XXXX is the DSM Port, with the message ERR_CONNECTION_TIMED_OUT).

At this point, the website is reachable at http://nasip:32789, you said it is better to use Port 443 instead of Port 80 for the encryption, is there a way to not block requests via Port 80, but redirect them to Port 443?
 
Anyway, I tried to change the RP like you suggested, added a CNAME record but I could not reach the website at http://wp.mydomain.com (after a while it changes y itself to https://wp.mydomain.com:XXXX where XXXX is the DSM Port, with the message ERR_CONNECTION_TIMED_OUT).
Do you have that domain name configured somewhere else in DSM by any chance? Like in the DSM advanced settings where the port numbers are?

At this point, the website is reachable at http://nasip:32789, you said it is better to use Port 443 instead of Port 80 for the encryption, is there a way to not block requests via Port 80, but redirect them to Port 443?
Well, you can block them easily by not opening port 80. The problem there is that you will then lose visitors that do not explicitly enter https as a protocol.

The best thing is to have an http to https redirect so that no matter what protocol is in question from the visitor side, they all end up on https.
Have a look here: HTTP to HTTPS redirect
 
Last edited:
Do you have that domain name configured somewhere else in DSM by any chance? Like in the DSM advanced settings where the port numbers are?
No, External Access>Advanced is empty. I used the domain only for generating Let's Encrypt certificate for mydomain.com.

The best thing is to have an http to https redirect so that no matter what protocol is in question from the visitor side, they all end up on https.
Have a look here: HTTP to HTTPS redirect
Thank you for this link! I don't have Web Station installed on the NAS, maybe is this the reason of website not working?
 
maybe is this the reason of website not working?
No. web station is for bare metal hosting only. You have your setup in docker. Depending on your choice of reverse proxy you might end up using http-https redirect that way or via reverse proxy of your choice
 
No. web station is for bare metal hosting only. You have your setup in docker. Depending on your choice of reverse proxy you might end up using http-https redirect that way or via reverse proxy of your choice
Ok, I am trying to follow step by step your tutorial for http/https redirect, hoping that I can finally reach the website at the correct url.
I had set up the wordpress container with Port 80, how can I modify it to Port 443? If I just change the Port number in Docker (Local port 8855 and container port 443), I am no more able to access the website at https://nasip:8855.
What should I do? Can I just leave Port 80 and proceed anyway with the redirect? In this case what I need to change?
 
I am no more able to access the website at https://nasip:8855.
Hmm what error you get exactly?

But you still have a working wp on 80 correct? So the only problem here is reverse proxy atm?

For that type of error I would say the reverse proxy host configuration is wrong. Maybe (but unlikely) a firewall rule on the nas.

Try and make one more simple docker container app and point your reverse proxy to that docker app and see if you will get the same problem. Maybe Wp is making a problem for you.
 
Last edited:
Hmm what error you get exactly?
I add in the wordpress container port Local port 8855 and container port 443, https://nasip:8855 gives ERR_CONNECTION_RESET.

But you still have a working wp on 80 correct?
Correct, http://nasip:32789 leads me to the wordpress website

So the only problem here is reverse proxy atm?
Correct, I want to reach the website using mydomain.com

For that type of error I would say the reverse proxy host configuration is wrong. Maybe (but unlikely) a firewall rule on the nas.
I temporarily added a firewall rule in the NAS at the top allowing all, so it should not be the firewall.

Try and make one more simple docker container app and point your reverse proxy to that docker app and see if you will get the same problem. Maybe Wp is making a problem for you.
I am using the reverse proxy for DSM login, that one works.
Anyway, I created a container with phpmyadmin. Connecting to http://nasip:8081 I reach it. I create a reversy proxy rule: in Source Protocol HTTP, Hostname php.mydomain.com, Port 80; in Destination Protocol HTTP, Hostname localhost, Port 8081. I added a CNAME record from php.mydomain.com to mydomain.com. ut when I visit http://php.mydomain.com I get DNS_PROBE_FINISHED_NXDOMAIN
 
Anyway, I created a container with phpmyadmin. Connecting to http://nasip:8081 I reach it. I create a reversy proxy rule: in Source Protocol HTTP, Hostname php.mydomain.com, Port 80; in Destination Protocol HTTP, Hostname localhost, Port 8081. I added a CNAME record from php.mydomain.com to mydomain.com. ut when I visit http://php.mydomain.com I get DNS_PROBE_FINISHED_NXDOMAIN
After DNS propagation, I can reach the phpmyadmin container at http://php.mydomain.com, this means that the Reverse Proxy worked in this case.

Maybe I should have installed Wordpress after seting up the Reverse Proxy? The website url in wordpress settings of admin page is set to http://mynas:32789
 
After DNS propagation, I can reach the phpmyadmin container at http://php.mydomain.com, this means that the Reverse Proxy worked in this case.

Maybe I should have installed Wordpress after seting up the Reverse Proxy? The website url in wordpress settings of admin page is set to http://mynas:32789
Ok, so the problem is either the WP container (but it works locally), or the fact that it took a while for the DNS to propagate.

Would then suggest to set a DNS record for the WP site (if it will be the root then use that one) and try again.

Also, now that you have this PHP dns record, simply use that record and redirect it to your WP contianer. Does that work?
 
Also, now that you have this PHP dns record, simply use that record and redirect it to your WP contianer. Does that work?
How should I do this?

Would then suggest to set a DNS record for the WP site (if it will be the root then use that one) and try again.
I tried to create a reversy proxy rule, same way used for phpmyadmin: in Source Protocol HTTP, Hostname www.mydomain.com, Port 80; in Destination Protocol HTTP, Hostname localhost, Port 32789. I added a CNAME record from www.mydomain.com to mydomain.com. Visiting http://www.mydomain.com I get ERR_CONNECTION_TIMED_OUT, and in the url bar appears the Port of the reverse proxy: www.mydomain.com:32789
 

Create an account or login to comment

You must be a member in order to leave a comment

Create account

Create an account on our community. It's easy!

Log in

Already have an account? Log in here.

Similar threads

Replies
4
Views
974
Wordpress has been working, then yesterday I noticed updates, did these above and now I can't get to the...
Replies
0
Views
1,232
Hi Akira, I tried to follow your directions the best I could but probably I failed because it does not...
Replies
8
Views
6,037
Alright! (y) No problem, happy to help. The beginning is always the hardest, but you will get the hang...
Replies
39
Views
9,619
Just notice Synology is offering to upgrade WordPress to Gutenberg (>5.0). That's what I have been long...
Replies
0
Views
12,775
<body> yes this what I mean. WordPress doesn't have such sophistic css/formating for 'code' , only...
Replies
6
Views
2,724

Welcome to SynoForum.com!

SynoForum.com is an unofficial Synology forum for NAS owners and enthusiasts.

Registration is free, easy and fast!

Trending threads

Back
Top