Label of this article: LEMP/LNMP Course Ubuntu Debian Ghost Debian8.x/Ubuntu16.04.x Build Ghost
Ghost It's a use Node.js Developed blog system, as opposed to using PHP WordPress It's lighter and more friendly, so this site has been switched from WordPress to Ghost In this paper, the author introduces the following points: Debian Building Ghost under 8.x and Ubuntu 16.04
All operations in this article are performed under root user, please switch it by yourself.
First, update the system
apt-get update && apt-get upgrade
If you use Debian 8.x opens backports and can be updated
apt-get -t jessie-backports update && apt-get -t jessie-backports upgrade
1. Install Node.js 6.x LTS
Since Node.js is older, we use it here. NodeSource Compiled Node.js source
Ubuntu lower
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - sudo apt-get install nodejs
Under Debian
curl -sL https://deb.nodesource.com/setup_6.x | bash - apt-get install nodejs
2. Installing Nginx
PPA can be used under Ubuntu, see Ubuntu Server 16.04.x (Xenial Xerus) LEMP/LNMP Installation Tutorial)
Debian It can be used next. Dotdeb See you for details. Debian 8.x "jessie" installs the latest version of LEMP / LNMP using Dotdeb
Then install Nginx and some necessary software
apt-get install nginx unzip wget curl sudo sqlite3
3. Download Ghost
Let's show you here. Ghost Download and unzip it in the / var/www/ghost directory
cd /var/www/ && wget https://ghost.org/zip/ghost-latest.zip && unzip ghost-latest.zip -d ghost && rm -rf ghost-latest.zip
4. Add ghost users and modify permissions
useradd ghost chown -R ghost:ghost /var/www/ghost
5. Modify config.js
cd /var/www/ghost cp -r config.example.js config.js
Then you can modify config.js to modify the config section according to the actual situation, as follows
config = { // ### Production // When running Ghost in the wild, use the production environment. // Configure your URL and mail settings here production: { url: 'http://example.com', // Modify the domain name of your blog to https if you need to start SSL mail: {}, database: { client: 'sqlite3', connection: { filename: path.join(__dirname, '/content/data/ghost.db') }, debug: false }, server: { host: '127.0.0.1', port: '2368' } },
If you need to send mail back to users, you can configure mail parameters, such as:
mail: { transport: 'SMTP', options: { service: 'Mailgun', auth: { user: '', // mailgun username pass: '' // mailgun password } } },
Ghost uses Nodemailer If you need the service name of another service provider, you can Official website documents Check in.
6. Install and start Ghost
cd /var/www/ghost npm install --production npm start --production
If prompted under Ubuntu 16.04
Error: Cannot find module '/var/www/ghost/node_modules/sqlite3/lib/binding/node-v48-linux-x64/node_sqlite3.node'
Then you need to install sqlite3 for nodejs
npm install sqlite3 --save
You can open http://127.0.0.1:2368/view the online version on this machine
7. Configure Nginx
Press ctrl + c to stop Ghost Then we can modify the Nginx configuration file, for example
server { listen 80; listen [::]:80; server_name example.com; location / { proxy_pass http://127.0.0.1:2368; proxy_redirect default; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forward-For $proxy_add_x_forwarded_for; proxy_set_header X-Forward-IP $remote_addr; proxy_set_header X-Forwarded-Proto $scheme; client_max_body_size 10m; client_body_buffer_size 512k; proxy_connect_timeout 5; proxy_read_timeout 60; proxy_send_timeout 5; proxy_buffer_size 16k; proxy_buffers 4 64k; proxy_busy_buffers_size 128k; proxy_hide_header X-Powered-By; } }
Check and reload nginx
nginx -t nginx -s reload
8. Install PM2 to keep Ghost running in the background
PM2 It is a popular Node.js process manager, which can start and close again.
First we install PM2 through npm
cd /var/www/ghost npm install pm2 -g
Configure the current environment, set the start-up, and save
NODE_ENV=production pm2 start index.js --name ghost pm2 startup pm2 save
The commands that may be needed later are
Start Ghost
pm2 start ghost
Stop Ghost
pm2 stop ghost
Restart Ghost
Usually used to modify the theme file or process fart-proof situation
pm2 restart ghost
Okay, that's it. The first account to open the browser and access http://example.com/ghost/registration is the full-site administrator, and then you can start. Ghost Blog Tour
Write in the end: FOR Freedom to see the outside world, as well as the IT industry, it is necessary to go to Google to look up information, and finally, Amway some speed agent.
Accelerator Recommendation | Free program | Payment scheme | Official website |
A Red Apricot Accelerator | Free scheme is not available yet, stable and high-speed | Enter 8% discount code wh80 and pay only 80 yuan per year. | Direct access to official websitehttp://whosmall.com/go/yzhx |
Anyun Accelerator | Best Use of Foreign Trade VPN | Minimum 30/month | Direct access to official websitehttp://whosmall.com/go/ay |
LoCo accelerator | Free 2 hours a day | Minimum 15/month | Direct access to official websitehttp://whosmall.com/go/loco |
Label of this article: LEMP/LNMP Course Ubuntu Debian Ghost Debian8.x/Ubuntu16.04.x Build Ghost
Turn from SUN'S BLOG - Focus on Internet knowledge and share the spirit of the Internet!
Original Address: uuuuuuuuuuuu How does Debian 8.x/Ubuntu 16.04.x build Ghost?>
Relevant Readings: The How can CentOS/RHEL 7.x upgrade OpenSSL?>
Relevant Readings: The CentOS/RHEL 7.x Installs the latest version of LEMP/LNMP tutorial using EPEL>
Relevant Readings: The Tip: Users can avoid paying a cancellation fee of $3 by giving feedback on canceling "drip trip" orders.>
Relevant Readings: The Backup data according to 3-2-1 principle to avoid being destroyed by blackmail software>
Relevant Readings: The How to install the latest version of LEMP / LNMP using Dotdeb?>
Relevant Readings: The Ubuntu Server 16.04 Installation of LEMP/LNMP Tutorial>
Relevant Readings: The Easy-to-use and full-featured Motion Mapping Tool on Mac System: GIF Brewery 3>
Relevant Readings: The A Fast and Efficient File Duplication Tool on MacOS System: Gemini 2>
Relevant Readings: The An Efficient Task Window Management Tool on MacOS System: HazeOver>
Relevant Readings: The How does MacOS upload files to Google Drive with LaunchBar?>
Relevant Readings: The Best Mac App Quick Start and Switch Tool: Manico 2.0>
Relevant Readings: The Why did I choose Windows Tidy as a MacOS splitting tool?>
Relevant reading: Useful for programmers: the latest Google hosts file download in 2017 and summary of various hosts problems encountered by netizens and configuration details
Relevant BLOG: SUN'S BLOG - Focus on Internet knowledge and share the spirit of the Internet! Go and see: www.whosmall.com
Original address: http://whosmall.com/?post=514