Toggle navigation

Ghost Image Guide

Version 1.8.5

Websoft9 Ghost is a pre-configured, ready to run image for running Ghost on Alibaba Cloud.

Ghost is a fully open source, hackable platform for building and running a modern online publication. We power blogs, magazines and journalists from Zappos to Sky News.Ghost’re a proud non-profit organisation building open source technology for journalism.Ghost was founded in April 2013, after a very successful Kickstarter campaign to create a new platform focused solely on professional publishing. It mission is to create the best open source tools for independent journalists and writers across the world, and have a real impact on the future of online media.

Application Software(Ghost1.8.5,Ghost-CLI1.1.1)
Ghost install directory: /data/wwwroot/ghost
Ghost configuration directory:/data/wwwroot/ghost/config.production.json
Note:Ghost-CLI is a command console for Ghost

Infrastructure(Node.js v6.11.3,Nginx 1.10.3)
Nginx configuration file: /etc/nginx/sites-available/default
Nginx log files: / var/log/nginx/error.log

Database(MYSQL5.7)
Database data directory:  /data/mysql
Database Configuration File: /etc/my.cnf

After the installation of Image,please verify it

  • Login on Alibaba Cloud console,get you Internet IP Address
  • Open you Chrome or Firefox on your local PC,visit the http://Internet IP Address and you can enter the Ghost directly,if there no response from browser,please check the Security Group settings to ensure that port 80 is been allowed

It is recommended to complete two steps before the the installation:

  • Domain resolution if you want to use domain for this application (Add an A record to the Internet IP Address of Server from Domain Control Panel)
  • Modify the MySQL password of root

Then access the installation page and complete the installation wizard for the following steps:

  1. http://domain.com/ghost or http://Inernet IP Address/ghost,go to the installation Wizard.Click the button “Create you account”.
  2. Begin to create your account(make sure remember it),and then go to the next step
  3. Sytem will remind you “invite you team”,suggest “I’ll do this later…”,and then go to the next step

  4. At last,system come to the backend of Ghost after the complete of installstion

Three usernames and passwords are required for application installation, application using, andapplication maintenance:

1、Ghost:Username and Password is set by youself when installation,
Backend URL:http://youdomain.com/ghost or http://ip/ghost
2、MySQL Database:Default username and password is root/123456
Control Panel URL:http://Internet IP Address/phpmyadmin
3、Linux Server:Username is root,Password is set by youself when buying.
Please Using the Putty for ssh remote and WinSCP for SFTP

Note:You can reset the password of OS through Cloud Console if you have forgotten it

Connect to a Linux instance using Windows OS

This section uses PuTTY as an example. PuTTY can be downloaded here.

You can connect to a Linux instance via PuTTY as follows:

  1. Start Putty.exe.
  2. Enter the public IP address of the instance in Host Name (or IP address).
  3. Use the default port 22.
  4. Select SSH as Connection Type.
  5. Type a session name in Saved Sessions, and then click Save. In later logins, you may directly load the session without re-entering the IP address.
  6. Click Open to connect.
  7. Upon first connection, the following dialog box will be displayed. Click Yes.
  8. As prompted, enter the username and password for the Linux ECS instance. The password will not be displayed on-screen. Press the Enter key to complete connection to the instance.

When you connect your computer to the Linux instance successfully, you can operate the instance from your computer.

Use SFTP you can mange file,upload and download file,configure Server.

  1. Start WinSCP. Login Dialog will appear.
  2. Then select your File protocol(SFTP) on the dialog
  3. Enter your host name to Host name field, username to User name and password to Password like below
  4. You may want to save your session details to a site so you do not need to type them in every time you want to connect. Press Save button and type site name.
  5. When appear the dialog below,please select the “yes”
  6. You can manane Linux file below
  7. WinSCP can integrate the Putty and transfer the log in information to Putty
  8. Now you can use Putty(Not need to log in) from the menu bar of WinSCP

Ghost themes live in the /data/wwwroot/ghost/content/themes directory and are also available in Ghost Marketplace.

We can intall theme using Web Interface

  • Download the theme in Ghost Marketplace.
  • upload and unzip theme package .zip file to  /data/wwwroot/ghost/content/themes
  • Restart the Ghost service
    root@iZbp1i4rjdsy216yq7lgucZ:/# ghost restart
    
  • Log into the application and navigate to “Settings -> General” section. Scroll down to the bottom of the page.
  • The new theme is displayed in the “Themes” section. Select the theme in the list and click the sav you want to perform.

In this example we assume you are using the Ghost CLI, which we highly recommend, to run your blog.

Preparation: backup your content

We can’t stress this enough – even if it all goes horribly wrong, recovering is quick and easy if you’re properly backed up. Use the export tool on the labs page to create a .json file and make copy of the /content folder in the root of your Ghost install – this contains your images and themes. Read our guide on importing & exportingfor detailed instructions.

Upgrading Ghost via the Ghost-CLI

Once you got all your important data backed up, you can go ahead and upgrade Ghost to the latest version:

ghost update

You will need to navigate to the folder of your current Ghost installation to execute this command. Ghost CLI will then fetch information about a newer version, download and install it.

After the installation, Ghost CLI will restart the app automatically.

 

How to configure Ghost?

Ghost has a number of configuration options which you can add to change things about how Ghost works.

you can modify the configuration file from /data/wwwroot/ghost/config.js

Name Required Description

url

only in production

Set the public URL for your blog

adminUrl

no

You can specify a separated admin url.

mail

only in production

Add a mail service so that Ghost can send emails such as forgotten password and user invite emails

database

only in production

The type of database that Ghost uses. This is configured to sqlite3 by default and does not need editing

server

no

Host and port, or socket for Ghost to listen on

privacy

no

Disable the Ghost features listed in PRIVACY.md, e.g. update check, rpc ping, and google fonts

paths

no

Customise Ghost’s internal paths, e.g. to the content directory

maintenance

no

Transform your blog into maintenance mode.

referrerPolicy

no

Control the content attribute of the meta referrer tag.

useMinFiles

no

Generate assets url with .min notation.

storage

no

Set a custom storage adapter, read more here Using a custom storage module

scheduling

no

Set a custom scheduling adapter, read more here Using a custom scheduling module

logging

no

Configure logging for Ghost.

spam

no

Configure spam settings.

caching

no

Configure caching settings.

How to Export the blog settings and data

Go to Administrator->Labs,Click the “Export” button,system download the jason file automatically

What is Markdown and how does it work?

Markdown is the minimal syntax that Ghost uses for marking up your documents with formatting, using punctuation and special characters. If you’re unsure of how to work with Markdown, please checkout our Markdown Guide.

How can I track how many views my site is getting?

You can easily get detailed data about how much traffic your site is getting by installing any standard analytics service. Google Analytics is the one very popular option, which is very simple to add to Ghost.

How do I upload an image into Ghost?

You can add an image to your post by typing ![]() in the editor, or pressing CMD/Ctrl + Shift + I. This will load an upload box in the post preview area for you to upload an image. More info here, if you need it

How can I edit my Ghost theme?

Editing a Ghost theme requires some basic development knowledge, but is relatively straightforward. You can follow along with our support guide to get started, or check out the full Ghost theme doumentation for more advanced areas.

How to define your own HTTP redirects

You can define your own HTTP redirects for your Ghost blog. The redirects file is a JSON file and needs to be located in content/data/redirects.json.

Each entry in the redirects file has the following structure:

{
  "from": "regex" ,
  "to":  "/url",
  "permanent": true | false
}

Permanent redirects (301) can be defined with permanent: true, otherwise we use 302 redirects as the default configuration.

Example:

[
    {
        "from": "^/post/[0-9]+/([a-z0-9\\-]+)",
        "to": "/$1"
    },
    {
        "permanent": true,
        "from": "/my-old-blog-post/",
        "to": "/revamped-url/"
    },
    {
        "from": "^\\/what(\\/?)$",
        "to": "/what-does-god-say"
    },
    {
        "from": "^\\/search\\/label\\/([^\\%20]+)$",
        "to": "/tag/$1"
    },
    {
        "from": "^\\/topic\\/",
        "to": "/"
    },
    {
        "from": "^/resources\\/download(\\/?)$",
        "to": "/shubal-stearns"
    },
    {
        "from": "^\\/[0-9]{4}\\/[0-9]{2}\\/([a-z0-9\\-]+)(\\.html)?(\\/)?$",
        "to": "/$1"
    },
    {
        "from": "^/prefix/([a-z0-9\\-]+)?",
        "to": "/blog/$1"
    }
]

How to configure the Mail?

Ghost requires a mail configuration in order to send emails to users. This is used for password resets, user invitations, system notifications, and other upcoming features. Ghost will try to use Nodemailer, if available, but configuring an external mail service will generally be more reliable.

More about Mail Configuration,please read Mail Configuration

You can use the command to manage the services for Server.Please choose the corresponding command mode according to different types of operating system

  • Ngnix Service
    ~# systemctl restart nginx.service
  • Ghost-CLI Service
    ~# ghost stop
    ~# ghsot restart 

Use domain you should complete the following steps:

If you want use Domain for this application,you should complete below steps:

  1. Domain resolution if you want to use (Add an A record to the Internet IP Address of Server from your Domain Control Panel).e.g,If you using the AliCloud Domain product,you should log in to your Domain Console Panel
  2. Modiy the Apache configuration file: /etc/nginx/sites-available/default

    server {
            listen 80 default_server;
            server_name _;
    
    
            location / {
             proxy_pass http://127.0.0.1:2368;
             proxy_set_header Host $host;
             proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            }
    
    }
  3. Restart the services
    root@iZuf65n6gzuzce01ma4usiZ:~# systemctl restart nginx.service

The following example will show you how to set up SSL. We assume, that you have followed this guide so far and use nginx as your proxy server. A setup with another proxy server should look similar.

First you need to obtain a SSL certificate from a provider you trust. Your provider will guide you through the process of generating your private key and a certificate signing request (CSR). After you have received the certificate file you have to copy the CRT file from your certificate provider and the KEY file which is generated during issuing the CSR to the server.

  • mkdir /etc/nginx/ssl
  • cp server.crt /etc/nginx/ssl/server.crt
  • cp server.key /etc/nginx/ssl/server.key

After these two files are in place you need to update your nginx configuration.

  • Open the nginx configuration file with a text editor (e.g. sudo nano /etc/nginx/sites-available/ghost.conf
  • Add the settings indicated with a plus to your configuration file:
server {
     listen 80;
+    listen 443 ssl;
     server_name example.com;
+    ssl_certificate        /etc/nginx/ssl/server.crt;
+    ssl_certificate_key    /etc/nginx/ssl/server.key;
     ...
     location / {
+       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+       proxy_set_header Host $http_host;
+       proxy_set_header X-Forwarded-Proto $scheme;
        proxy_pass http://127.0.0.1:2368;
        ...
     }
 }

— Restart nginx

$ sudo service nginx restart

After these steps you should be able to reach the admin area of your blog using a secure HTTPS connection. If you want to force all your traffic to use SSL it is possible to change the protocol of the url setting in your config.js file to https (e.g.: url: 'https://my-ghost-blog.com'). This will force the use of SSL for frontend and admin. All requests sent over HTTP will be redirected to HTTPS. If you include images in your post that are retrieved from domains that are using HTTP an ‘insecure content’ warning will appear. Scripts and fonts from HTTP domains will stop working.

In most cases you’ll want to force SSL for the administration interface and serve the frontend using HTTP and HTTPS. To force SSL for the admin area you can use the forceAdminSSL: true configuration option. For more information on configuring your blog to work with SSL, see the config Guide.

If you need further information on how to set up SSL for your proxy server the official SSL documention of nginxand apache are a perfect place to start.

 

You should add new Nginx Configuration file when you have add new Node.JS application on this Image,please follow below:

  1. Set you DNS from Domain Admin Panel,make sure one A record resolution to Internet IP Address,e.g 47.88.157.4
  2. Make sure you have completed the installation of application and you can visit the Your_app through http://47.88.157.4:2000
  3. Create a new file in /etc/nginx/sites-available/ called your_apps.conf
  4. Open the file with a text editor (e.g. sudo nano /etc/nginx/sites-available/your_apps.conf) and paste the following:
    server {
     listen 80;
     server_name example.com;
    
     location / {
         proxy_set_header   X-Real-IP $remote_addr;
         proxy_set_header   Host      $http_host;
         proxy_pass         http://127.0.0.1:2000;
     }
    }
  5. Change server_name to your domain
  6. Symlink your configuration in sites-enabled:
    $ sudo ln -s /etc/nginx/sites-available/ghost.conf /etc/nginx/sites-enabled/your_apps.conf
  7. Restart nginx
    $ sudo service nginx restart

Config Domain on Apache

If you use Apache HTTP Server,please follow below:

  1. Set you DNS from Domain Admin Panel,make sure one A record resolution to Internet IP Address,e.g 47.88.157.4
  2. Make sure you have completed the installation and you can visit the Ghost through http://47.88.157.4:2000
  3. Modify the /usr/local/apache/conf/httpd.conf
    Enable the proxy module by removing the “#” before it
    LoadModule proxy_module modules/mod_proxy.so
    LoadModule proxy_http_module modules/mod_proxy_http.so
  4. Add new config code snippet to /usr/local/apache/conf/extra/httpd-vhosts.conf
    Note:172.21.172.27 is you Server’s Private IP Address

    <VirtualHost *:80>
    ServerAdmin webmaster@dummy-host2.localhost
    ServerName youdomain.com
    ProxyRequests off
    <Proxy *>
    Order deny,allow
    Allow from all
    </Proxy>
    ProxyPass / http://172.21.172.27:20000/
    ProxyPassReverse / http://172.21.172.27:20000/
    </VirtualHost>
  5. Modify the /usr/local/apache/conf/httpd.conf,remove the “#” before Include conf/extra/httpd-vhosts.conf
    # Virtual hosts
    Include conf/extra/httpd-vhosts.conf
  6. Restart Apache
    # service httpd restart

SSL Setup on Apache

SSL Setup on Apache is similar with Nginx.

  1. First you need to obtain a SSL certificate from a provider you trust.
  2. then Modify you vhosts like below
    <VirtualHost *:80>
    ServerAdmin webmaster@dummy-host2.localhost
    ServerName youdomain.com
    ProxyRequests off
    SSLEngine on
     SSLCertificateFile "/usr/local/apache/conf/ssl/www.websoft9.cn.crt"
     SSLCertificateKeyFile "/usr/local/apache/conf/ssl/www.websoft9.cn.key"
    <Proxy *>
    Order deny,allow
    Allow from all
    </Proxy>
    ProxyPass / http://172.21.172.27:20000/
    ProxyPassReverse / http://172.21.172.27:20000/
    </VirtualHost>
  3. Restart Apache Server

Get more from :mod_ssl Configuration How-To