My VPS Situation:
Operating system –centos 7 64-bit
Web Server Software –apache
Ghost1 is based on Node.js, which itself has a Web server and does not need Apache.
Install Ghost
Main reference Ghost official Help 2.
Download Ghost
$ curl-l Https://ghost.org/zip/ghost-latest.zip-o ghost.zip
Decompression Ghost
$ unzip-uo ghost.zip-d Ghost
Install Ghost
$ CD Ghost
$ NPM Install--production
Start Ghost
$ npm Start--production
Now, you can access the Ghost blog via the 127.0.0.1:2368 path on the VPS.
Configure Apache with Ghost
Of course, your goal is not to visit Ghost on the VPS, but to access Ghost through the domain name.
Ghost Directory has a config.example.js file, used to configure information 3, such as domain names, ports and so on.
Before you do the following, make sure you bind the domain name to the IP address of the VPS on the DNS server.
Copy a Config.js
$ CD Ghost
$ CP config.example.js Config.js
Modify Config.js
Change the URL in the production section of Config.js: ' http://my-ghost-blog.com ' to URL: ' Http://111cn.net ', which is the domain name I want to use.
Restart Ghost
Press Ctrl-c to turn off Ghost, and then perform NPM start--production to start it.
At this point you can see the following message:
Migrations:up to date at version 003
Ghost is running ...
Your Blog is now available on http://111cn.net
CTRL + C to shut down
But this information does not mean that we have access to Ghost. Because the 111cn.net domain name accesses port 80, the port is listening on Apache instead of node.js– it is listening on the 2368 port.
So we also need to configure Apache.
Open the/etc/httpd/conf.d/vhost.conf file (CentOS system) and add the following:
<virtualhost *:80>
ServerName www.111cn.net
Serveralias 111cn.net
Proxypreservehost on
proxypass/http://localhost:2368/
proxypassreverse/http://localhost:2368/
</VirtualHost>
Restart Apache:
$ sudo service httpd Restart
in this way, Apache acts as a proxy, forwarding the traffic it hears to the node.js listening port, and when we visit http://111cn.net, we can open the Ghost blog