How setup ghost blog with apache2

First of all, this is not the recommended way of the ghost maintainers but in my case i did not want to setup many different reverse proxies on my main server and therefore i tried it to get working with my existing apache2.

Primarily, follow many of the steps from the getting started at https://ghost.org/docs/install/ubuntu/

adduser ghost
sudo apt-get install mysql-server
sudo mysql

# Now update your user with this password
# Replace 'password' with your password, but keep the quote marks!
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';

CREATE USER 'ghost'@'localhost' IDENTIFIED BY 'password';

CREATE DATABASE ghost;

GRANT ALL PRIVILEGES ON ghost.* TO 'ghost'@'localhost';

FLUSH PRIVILEGES;

# Then exit MySQL
quit
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash
sudo apt-get install -y nodejs
sudo npm install ghost-cli@latest -g


sudo mkdir -p /var/www/html/ghost

sudo chown ghost:ghost /var/www/html/ghost

sudo chmod 775 /var/www/html/ghost

cd /var/www/html/ghost
ghost install local


cp config.development.json config.production.json

How to install and try Ghost Blog in your own computer
Choosing a suitable blogging platform can be daunting… How do we know if Ghost is a suitable blogging platform for us? The best way perhaps is to install Ghost Blog locally and try it out.

Change database entry to:
"client": "mysql",
"connection": {
"host": "127.0.0.1",
"port": 3306,
"user": "ghost",
"password": "password",
"database": "ghost"
}

Change url to proxied url:

ServerName blog.heinzl.dev



    ProxyRequests Off
    ProxyVia Off

<Proxy *>
     Require all granted
</Proxy>

ProxyPreserveHost   On

RequestHeader set X-Forwarded-Proto "https"
ProxyPass / http://127.0.0.1:2368/
ProxyPassReverse / http://127.0.0.1:2368/

[Unit]
Description=ghost
After=network.target

[Service]
Type=forking

Ghost installation Directory

WorkingDirectory=/var/www/html/ghost
User=ghost
Group=ghost
ExecStart=/usr/bin/ghost start
ExecStop=/usr/bin/ghost stop
Restart=always
SyslogIdentifier=Ghost

[Install]
WantedBy=multi-user.target