When I try to install Ghost to server where Plesk panel is used, I found some problem. By default, Plesk server use 10.6.16-MariaDB, but ghost require Mysql, not MariaDB. Therefore we need install Ghost CMS via Docker.
There is main steps.
Install "Docker" plesk extension https://YOURSERVER:8443/modules/catalog/index.php/catalog/package/docker
Make domain via plesk panel + set ssl let's encrypt
Install "Nginx" plesk extension (if not installed) https://YOURSERVER:8447/installer/add_components.html
Check "Web hosting" > "Nginx web server and reverse proxy server"
Start Nginx service on https://YOURSERVER:8443/admin/services/list
Connect to mysql console via ssh console: mysql -u root -p -P3006
Execute this commands (for example) in order to create user & db for Ghost CMS:
CREATE DATABASE exampledb;
CREATE USER 'exampledbu'@'%' IDENTIFIED BY 'ExampleSecretPhrase';
GRANT ALL ON exampledb.* TO 'exampledbu'@'%';
FLUSH PRIVILEGES;
EXIT (ctrl + D)
Container Name: Call this whatever you want, ideally something relating to your site. For this example, we're calling this ghost_examplecom_container
Check the box for "Automatic start after system reboot"
Un-check the box for "Automatic port mapping"
Manual mapping: 2368 to external 32778
Volume mapping: "Container" placeholder: /var/lib/ghost/content "Host" placeholder: /var/ghost/ghost_examplecom_container/content (replace ghost_examplecom_container with your container name from the top of the page!
Near the bottom of the page, click on "Add Variable"
In the blank boxes, type "url" in the first box and your URL (eg: "https://example.com" in the second box (Make sure this domain is registered and added to Plesk)
Ensure that the database has been created first before proceeding. The information below is just sample data and should not be used!
Add the database details: database__client - mysql database__connection__host - 172.17.0.2 (Your Docker internal network IP address) database__connection__user - exampledbu database__connection__password - "ExampleSecretPhrase" database__connection__database - exampledb database__connection__port - 3306
Now click "OK" and let it install.
But we check docker network and found: 172.17.0.2 - mysql8_container with 3306 port open 172.17.0.1 - ghost_examplecom_container
Well, we can use it!
Go back to "Websites & Domains" and find your site, click on "Docker Proxy Rules"
Click "Add Rule" URL: Leave this alone Container: Choose your container Port: This should say 2368 -> 32778 Click "OK"
How do access the files if I want to import themes or other content? Connect via SSH to your server (FTP will not work) /var/ghost/ghost_examplecom_container/content/
What if I want to run a 2nd or 3rd Ghost blog on Plesk? Repeat the steps above, the only thing to change are: The "Container Name" The port, change it from 32778 to 32779
What if I want it at example.com/blog? Indicate this in the url on the setup page. And when you add it in the rule on the "Docker Proxy Rules" page, add blog where it says "URL"
I want to move this to/from a subdomain from/to a naked domain? Go into the "Docker Proxy Rules" and remove the rule from here. Go into "Docker" on the left-hand side. Click on "Settings" beside the container and adjust the url in here. This will more than likely restart the container. Re-add the "Docker Proxy Rules" to the new subdomain or naked domain.