sumarsono.com
Take it with a grain of salt


Install Ghost di Alpine Linux Server

Posted on

Install NodeJS, Nginx, dan Ghost CLI

# apk add nodejs npm nginx
# npm install ghost-cli@latest -g

Bikin user dan direktori untuk Ghost

# adduser ghost
# su - ghost
$ mkdir /home/ghost/blog
$ mkdir /home/ghost/logs

Install Ghost

$ cd /home/ghost/blog
$ ghost install
$ chown -R ghost:ghost /home/ghost/blog
$ exit

Bikin Vhost Nginx

# vim /etc/nginx/http.d//ghost.conf
server {
	listen 80;
	listen [::]:80;

	server_name blog.kube.my.id;

	location / {
		proxy_set_header X-Real-IP $remote_addr;
		proxy_set_header HOST $http_host;
		proxy_set_header X-NginX-Proxy true;
		proxy_pass http://127.0.0.1:2368;
		proxy_redirect off;
	}
}

Bikin OpenRC Service

# vim /etc/init.d/ghost
#!/sbin/openrc-run

command="/usr/bin/node"
directory="/home/ghost/blog"
command_args="/usr/local/bin/ghost run"
command_background="yes"
command_user="ghost:ghost"
pidfile="/run/${RC_SVCNAME}.pid"
output_log="/home/ghost/logs/${RC_SVCNAME}.log"
error_log="/home/ghost/logs/${RC_SVCNAME}.log"

depend() {
  use net
}
# chmod +x /etc/init.d/ghost

Start Service

# rc-update add nginx
# rc-update add ghost
# service nginx start
# service ghost start