Recently I am Installed the Ghost Blog CMS via Stack Method.
I Face ghost.service Failed to Restart issue due to it missing ghost.service file
But in direct installation Method, It will Automatically Create and Configure the ghost.service
if you are installed Ghost Blog CMS via Stack Method we need to Manually install and activate the ghost.service
ghost.service is very important in Ghost Blog CMS yes if we made any changes in backends we need to restart the ghost then only your backend changes will take effect.
How to Guide
Ok now let's come to tutorial part
How to Install and Activate the ghost.service on Ubuntu
Requirements
- this method only applicable to the users who installed the ghost blog CMS via stack method
- Folder path - /var/www/ghost
Installation Steps
- open your Droplet/server on the terminal
- create ghost.service on
systemd
file
nano /etc/systemd/system/ghost.service
- Now copy and paste this below code on the newly created ghost.service file
[Unit]
Description=ghost
After=network.target
[Service]
Type=simple
WorkingDirectory=/var/www/ghost
ExecStart=/usr/bin/npm start --production
ExecStop=/usr/bin/npm stop --production
Restart=always
SyslogIdentifier=Ghost
User=ghost
Group=ghost
ProtectSystem=full
ProtectHome=yes
PrivateTmp=yes
PrivateDevices=yes
[Install]
WantedBy=multi-user.target
- press CTRL + X to save the File
- After that, it ask confirmation for store the New changes Press Y to Create and Save the File
- Click Enter to Exit
- Reload the systemd daemon
systemctl daemon-reload
- Now Run this Below Command line Enable the Ghost service
systemctl enable ghost.service
- Start the Ghost service
systemctl start ghost.service
- Verify your Ghost service Status
systemctl status ghost
- you will get this output
root@ghostblogcms:~# systemctl status ghost
● ghost.service - ghost
Loaded: loaded (/etc/systemd/system/ghost.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2017-06-08 14:40:31 UTC; 3min 53s ago
Main PID: 2287 (npm)
CGroup: /system.slice/ghost.service
├─2287 npm
├─2299 sh -c node index
└─2300 node index
- That's all successfully we install and activate the ghost.service