Hosting a WordPress website

Currently reading
Hosting a WordPress website

47
5
NAS
DS920+
Operating system
  1. Windows
Mobile operating system
  1. Android
Hi, I am trying to host a WordPress website on my Synology NAS.

I found many sources on the web and tried to follow step-by-step some tutorials: I tried with Wordpress package, I tried with Docker, I even tried to directly install WordPress in the Shared Folder. None of these attempts was successful, that is why now I would like to receive suggestions and help for hosting the website based on my actual needs and environment:
  • WordPress website with few pages and a limited amount of visitors (10-100 per day),
  • Static public IP address provided by ISP,
  • Registered domain to be associated with the website,
  • Synology NAS DS920+, DSM 6.2.4, running OpenVPN,
  • Router FRITZ!Box 7590 on which I am manually opening NAS ports.
Based on these requirements, which would be in your opinion the best option for hosting a WordPress website?

Thanks,

Giacomo
 
Well Docker would be the best way in the long run, for various reasons.

When you say none were successful, what was the end result exactly in the case of WP over Docker for example? Can you share what method you used in that case (or tutorial that you followed)?

Open VPN on your NAS is that a VPN server package (so that you can get back to your LAN), or is your NAS a VPN client to a 3rd party public OpenVPN provider?

Again, getting WP in Docker would be a way to go, as you would be able to migrate your setup to any other Docker compatible host in the future and not locking yourself with Synology as a vendor. Also, you will not be dependant on the update for WP from Synology but would use an official WP up-to-date repo, so from a feature and security standpoint, it would be a way to go.

Give us a bit more info on the attempts in more detail (if possible) and we can take it from there.
 
When you say none were successful, what was the end result exactly in the case of WP over Docker for example? Can you share what method you used in that case (or tutorial that you followed)?
These are the tutorials I followed:
Open VPN on your NAS is that a VPN server package (so that you can get back to your LAN), or is your NAS a VPN client to a 3rd party public OpenVPN provider?
VPN Server package installed on the NAS for remotely accessing it via private network.

Again, getting WP in Docker would be a way to go, as you would be able to migrate your setup to any other Docker compatible host in the future and not locking yourself with Synology as a vendor. Also, you will not be dependant on the update for WP from Synology but would use an official WP up-to-date repo, so from a feature and security standpoint, it would be a way to go.
Thanks for the explanation, then it seems reasonable to me to proceed with Docker!
 
Thanks for the explanation, then it seems reasonable to me to proceed with Docker!
Well i would definitely agree on that. Considering that I can’t reach that docker tutorial atm (page not opening), I would say that it’s either not configured correctly or the setup hasent been completed yet (db connection etc).

Have you managed to configure the WP or have you stopped at that 1st step, accessing the site in order to configure it?

Give a bit more details on your exact steps.
 
Considering that I can’t reach that docker tutorial atm (page not opening)
Yes, sorry, the link seems no more active. I found it here anyway: Wordpress in Docker

Following that tutorial, I installed Docker and created two containers, one for MariaDB and one for Wordpress.
I created the user and the database and connected them to Wordpress, from the log of the containers it seemed all working correctly and I was able to access the html and mysql folders in the NAS Shared Folder. What I was not able to, was to reach from the browser the content of the html folder for launching install.php.

In this other thread that I opened, I am expressing my doubts about VPN/Firewall/ports set-up, maybe the issues are somehow connected?

Thanks
 
maybe the issues are somehow connected?
I would say no. So you have the situation that the install is not kicking in considering that you can’t start the install process.

when you access the install page what does the web inspector report (depending on your browser) about the exact errror? What’s the error exactly?
 
Unfortunately I uninstalled Docker after the failed attempt, and without that tutorial I am not able to exactly reproduce the same error. Is there any other tutorial that you would suggest to follow?
Thanks!
 
After some web searches and having found nothing useful, I decided to recover that tutorial from the browser cache and repeated the instructions:
  • Installed Docker
  • From "Registry" tab downloaded latest MariaDB and Wordpress images
  • In File Station created the folders docker/wordpress/html and docker/wordpress/sql
  • For MariaDB created a container named "wordpressdb", in the setting I checked "Enable auto-restart", in Volume mapped the folder docker/wordpress/sql to mount path /var/lib/mysql, in Port Settings Local Port "auto" and Container Port "3306", nothing in Links, and in Environment created:
    • MYSQL_DATABASE: name_your_database
    • MYSQL_ROOT_PASSWORD: choose_root_password
    • MYSQL_USER: your_user_name
    • MYSQL_PASSWORD: choose_user_password
  • For Wordpress created a container named "wordpress", in the setting I checked "Enable auto-restart", in Volume mapped the folder docker/wordpress/html to mount path /var/www/html, in Port Settings Local Port "32789" and Container Port "80", in Links Container Name "wordpressdb" and Alias "mysql", and in Environment created:
    • WORDPRESS_DB_HOST: the_container_name_for_your_DB (i.e. "wordpressdb")
    • WORDPRESS_DB_NAME: name_of_your_database (from previous step)
    • WORDPRESS_DB_USER: user_name (from previous step)
    • WORDPRESS_DB_PASSWORD: user_password (from previous step)
  • Started all the containers, checked the successful log in the containers and from the IP address of the Synology (http://192.168.0.55:32789) I should have reached the Wordpress page.
The outcome of this tentative was this message: "Error establishing a database connection".

Are these steps ok for hosting a Wordpress website with Docker? What should I do for solving this error?
Thank you!
 
Port Settings Local Port "auto"
This is not something I would personally do. Letting your docker container on auto port. Fix the DB port side to 3306 and then try again.

Also, you could try and use WORDPRESS_DB_HOST: as your nas ip address and not the container name, and also add your 3306 port number as well, see if that will make a difference for you.

WORDPRESS_DB_HOST=nasip:port
 
Ok, I removed auto and set both the Local Port and the Container Port of MariaDB container to 3306.
I set WORDPRESS_DB_HOST: 192.168.0.55:3306 but still that error when visiting 192.168.0.55:32789.

I share the log screenshots, maybe they are useful for finding the problem.

MariaDB container:
logdb.PNG


Wordpress container:
logwp.PNG
 
Well in that case this should work just fine.

I have just tested WP and it connected fine using the following varaibles:

Code:
WORDPRESS_DB_HOST    NASIP:3306
WORDPRESS_DB_NAME    wp
WORDPRESS_DB_PASSWORD    wppassword
WORDPRESS_DB_USER    wpuser

The container then reported this in the log (successful detection of those variables)

Code:
WordPress not found in /var/www/html - copying now...

Complete! WordPress has been successfully copied to /var/www/html

No 'wp-config.php' found in /var/www/html, but 'WORDPRESS_...' variables supplied; copying 'wp-config-docker.php' (WORDPRESS_DB_HOST WORDPRESS_DB_NAME WORDPRESS_DB_PASSWORD WORDPRESS_DB_USER)

AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.24.0.2. Set the 'ServerName' directive globally to suppress this message

AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.24.0.2. Set the 'ServerName' directive globally to suppress this message

[Mon May 17 09:15:22.919394 2021] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.38 (Debian) PHP/7.4.19 configured -- resuming normal operations

And the install was accessible on http://nasip:port:

Screenshot 2021-05-17 at 11.16.57.png


Things that you could test out now is can your WP container connect to your SQL instance. If they are both in bridge that would mean that anything on your NAS LAN subnet should see that instance as well.

So from your pc you could run a terminal/command prompt line to test out your connectivity towards the DB.

Try: telnet yourNASIP 3306 and see what you get in return. If you manage to connect then you are golden.
 
I tried this in command prompt as I read here:
mysql -u root -p -h nasip

Entered the password and the result is this one:
telnet2.PNG


In this case it seems that the connection is correctly established.
 
In this case it seems that the connection is correctly established.
Correct. So the DB side of things, from the access, password etc point of view, works. That leaves the WP container problem and communication with the SQL side.

Just to be clear, have you done this using the Synology Docker web ui or?
 
Just to be clear, have you done this using the Synology Docker web ui or?
I am not sure I understood the question.
If you are referring to the connection to the database, I used the command prompt from a computer connected via VPN to the NAS network, and not the terminal of MariaDB container in the Synology Docker ui.
 

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
1,185

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