{"id":4465,"date":"2026-09-12T17:32:52","date_gmt":"2026-09-12T12:02:52","guid":{"rendered":"https:\/\/cpanelfree.com\/blog\/how-to-host-ghost-cms-mysql-nginx-ubuntu-vps\/"},"modified":"2026-09-17T11:24:07","modified_gmt":"2026-09-17T05:54:07","slug":"how-to-host-ghost-cms-mysql-nginx-ubuntu-vps","status":"publish","type":"post","link":"https:\/\/cpanelfree.com\/blog\/how-to-host-ghost-cms-mysql-nginx-ubuntu-vps\/","title":{"rendered":"How to Host Ghost CMS with MySQL and Nginx on Ubuntu VPS (Step-by-Step)"},"content":{"rendered":"<p>For independent journalists, technical bloggers, and digital media publications, <strong>Ghost CMS<\/strong> has emerged as the premier modern alternative to WordPress. Engineered entirely in Node.js with a lightning-fast Ember\/React administrative interface and a clean Handlebars templating engine, Ghost is built from the ground up for high-velocity publishing, native newsletter subscriptions, and paid membership monetization.<\/p>\n<p>While the official managed Ghost Pro platform charges escalating fees based on subscriber counts, self-hosting Ghost CMS on an optimized <a href=\"https:\/\/cpanelfree.com\/\">Linux VPS<\/a> delivers unmetered subscriber capacity, complete data sovereignty, and sub-50ms response times at fixed hardware costs. This tutorial walks you through server preparation, Node.js runtime installation, MySQL database configuration, Ghost-CLI automated deployment, and production Nginx reverse proxy tuning.<\/p>\n<h2>1. Server Hardware Sizing &amp; Baseline Prerequisites<\/h2>\n<p>To ensure responsive performance during traffic surges, ensure your VPS meets these baseline specifications:<\/p>\n<ul>\n<li><strong>Operating System:<\/strong> Ubuntu 24.04 LTS or 22.04 LTS (clean minimal install).<\/li>\n<li><strong>Memory:<\/strong> Minimum 1GB RAM (2GB+ recommended to prevent Node.js garbage collection memory spikes during newsletter dispatch).<\/li>\n<li><strong>Database:<\/strong> MySQL 8.0 Server (Ghost strictly requires MySQL 8 in production; MariaDB is not officially supported by upstream Ghost-CLI).<\/li>\n<li><strong>Web Server:<\/strong> Nginx reverse proxy terminating SSL on ports 80 and 443.<\/li>\n<\/ul>\n<h2>2. Installing Node.js LTS, Nginx &amp; MySQL 8<\/h2>\n<p>Ghost requires an active Node.js LTS release (Node.js 18 or 20). Install dependencies via NodeSource:<\/p>\n<pre><code># Update repository cache\nsudo apt update &amp;&amp; sudo apt upgrade -y &amp;&amp; sudo apt install -y curl nginx mysql-server ufw\n\n# Import NodeSource Node.js 20 LTS repository\ncurl -fsSL https:\/\/deb.nodesource.com\/setup_20.x | sudo -E bash -\nsudo apt install -y nodejs\n\n# Verify versions\nnode -v &amp;&amp; npm -v\n# Output confirms Node.js v20.x and npm 10.x<\/code><\/pre>\n<p>Run <code>sudo mysql_secure_installation<\/code> to lock down database security, then initialize a dedicated database and user for Ghost:<\/p>\n<pre><code>sudo mysql -u root -p &lt;&lt; 'EOF'\nCREATE DATABASE ghost_production CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;\nCREATE USER 'ghost_user'@'localhost' IDENTIFIED BY 'StrongRandomGhostPassword2026!';\nGRANT ALL PRIVILEGES ON ghost_production.* TO 'ghost_user'@'localhost';\nFLUSH PRIVILEGES;\nEOF<\/code><\/pre>\n<h2>3. Installing Ghost-CLI &amp; System Preparation<\/h2>\n<p>Ghost strictly forbids running commands as the root user. Create a dedicated system user and install the official Ghost command-line interface globally:<\/p>\n<pre><code># Install Ghost-CLI globally\nsudo npm install -g ghost-cli@latest\n\n# Create non-root user and assign sudo privileges\nsudo adduser --gecos \"\" ghostuser\nsudo usermod -aG sudo ghostuser\n\n# Create target web root directory\nsudo mkdir -p \/var\/www\/ghost\nsudo chown ghostuser:ghostuser \/var\/www\/ghost\nsudo chmod 775 \/var\/www\/ghost<\/code><\/pre>\n<h2>4. Executing Automated Ghost Production Installation<\/h2>\n<p>Switch to your unprivileged user account and execute the interactive Ghost installation wizard:<\/p>\n<pre><code>su - ghostuser\ncd \/var\/www\/ghost\nghost install<\/code><\/pre>\n<p>The Ghost-CLI will prompt you for configuration details:<\/p>\n<ul>\n<li><strong>Blog URL:<\/strong> <code>https:\/\/yourdomain.com<\/code><\/li>\n<li><strong>MySQL hostname:<\/strong> <code>localhost<\/code><\/li>\n<li><strong>MySQL username:<\/strong> <code>ghost_user<\/code><\/li>\n<li><strong>MySQL password:<\/strong> <code>StrongRandomGhostPassword2026!<\/code><\/li>\n<li><strong>Ghost database name:<\/strong> <code>ghost_production<\/code><\/li>\n<li><strong>Set up a &#8216;ghost&#8217; mysql user?<\/strong> &rarr; <code>no<\/code> (already configured)<\/li>\n<li><strong>Set up Nginx?<\/strong> &rarr; <code>yes<\/code> (automatically writes optimized server blocks)<\/li>\n<li><strong>Set up SSL?<\/strong> &rarr; <code>yes<\/code> (automatically provisions Let&#8217;s Encrypt certificates)<\/li>\n<li><strong>Set up systemd service?<\/strong> &rarr; <code>yes<\/code> (configures auto-start on boot)<\/li>\n<li><strong>Start Ghost?<\/strong> &rarr; <code>yes<\/code><\/li>\n<\/ul>\n<h2>5. Tuning Nginx Reverse Proxy for Ghost<\/h2>\n<p>Ghost-CLI automatically generates an Nginx configuration file in <code>\/etc\/nginx\/sites-available\/yourdomain.com.conf<\/code>. To ensure large image and theme uploads do not fail with HTTP 413 errors, verify that <code>client_max_body_size<\/code> is set properly:<\/p>\n<pre><code>server {\n    listen 443 ssl http2;\n    server_name yourdomain.com;\n\n    # Allow large media uploads\n    client_max_body_size 50M;\n\n    location \/ {\n        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n        proxy_set_header X-Forwarded-Proto $scheme;\n        proxy_set_header X-Real-IP $remote_addr;\n        proxy_set_header Host $http_host;\n        proxy_pass http:\/\/127.0.0.1:2368;\n    }\n}<\/code><\/pre>\n<p>Navigate to <code>https:\/\/yourdomain.com\/ghost<\/code> to complete initial administrator registration and launch your modern publication.<\/p>\n<h2>5. Configuring Transactional Email with Mailgun &amp; Ghost Custom Routing<\/h2>\n<p>Ghost relies strictly on external transactional email services to handle member newsletters, signup verification links, and staff invitations. Sending email directly from local Sendmail or Postfix almost always results in spam folder placement. Mailgun is the officially recommended standard for Ghost instances:<\/p>\n<ul>\n<li><strong>Configuring config.production.json:<\/strong> Open <code>\/var\/www\/ghost\/config.production.json<\/code> and add your Mailgun SMTP credentials under the <code>mail<\/code> object:\n<pre><code>\"mail\": {\n  \"transport\": \"SMTP\",\n  \"options\": {\n    \"service\": \"Mailgun\",\n    \"host\": \"smtp.mailgun.org\",\n    \"port\": 587,\n    \"secure\": false,\n    \"auth\": {\n      \"user\": \"postmaster@mg.yourdomain.com\",\n      \"pass\": \"your_mailgun_api_smtp_key\"\n    }\n  }\n}<\/code><\/pre>\n<\/li>\n<li><strong>Restarting Ghost Daemon:<\/strong> Execute <code>ghost restart<\/code> inside <code>\/var\/www\/ghost<\/code> to apply the updated mail configuration. Navigate to <strong>Settings &gt; Email newsletter<\/strong> in the Ghost Admin dashboard and send a test newsletter to verify DKIM, SPF, and DMARC alignment.<\/li>\n<li><strong>Custom Dynamic Routing (routes.yaml):<\/strong> Ghost allows custom taxonomic structures, podcast feeds, and membership paywalls via <code>routes.yaml<\/code>. Download your default routing file from <strong>Settings &gt; Labs &gt; Routes<\/strong>, configure custom collections (e.g., separating technical tutorials from company announcements), and upload the YAML file without restarting the Node.js server.<\/li>\n<\/ul>\n<h2>6. Automated Daily MySQL Backups &amp; Image Optimization<\/h2>\n<p>Ensure business continuity by automating daily database dumps and media synchronization to secure cloud storage:<\/p>\n<pre><code># Create backup script \/opt\/backup_ghost.sh\nmysqldump -u ghost_user -p'YourStrongPassword' ghost_production | gzip &gt; \/backups\/ghost_db_$(date +\\%F).sql.gz\ntar -czf \/backups\/ghost_content_$(date +\\%F).tar.gz \/var\/www\/ghost\/content\/images\/<\/code><\/pre>\n<p>Schedule this script to run daily at 02:00 AM via crontab to maintain redundant point-in-time recovery archives.<\/p>\n<div style=\"background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);border: 1px solid #334155;border-radius: 12px;padding: 28px;margin: 36px 0;text-align: center\">\n<h3 style=\"color: #38bdf8;margin-top: 0;font-size: 22px\">Host Ghost CMS on High-Speed CpanelFree VPS<\/h3>\n<p style=\"color: #cbd5e1;font-size: 16px;line-height: 1.6;max-width: 680px;margin: 12px auto 24px auto\">Unmetered members, unlimited newsletters, and pure NVMe performance. Deploy Ghost CMS on reliable, high-performance cloud infrastructure with CpanelFree.<\/p>\n<p>    <a href=\"https:\/\/cpanelfree.com\/\" style=\"background: #38bdf8;color: #0f172a;font-weight: 700;padding: 12px 28px;border-radius: 6px;text-decoration: none;display: inline-block;font-size: 15px\">Discover CpanelFree Cloud VPS &rarr;<\/a>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>For independent journalists, technical bloggers, and digital media publications, Ghost CMS has emerged as the premier modern alternative to WordPress. Engineered entirely in Node.js with a lightning-fast Ember\/React administrative interface and a clean Handlebars templating engine, Ghost is built from the ground up for high-velocity publishing, native newsletter subscriptions, and paid membership monetization. While the &#8230; <a title=\"How to Host Ghost CMS with MySQL and Nginx on Ubuntu VPS (Step-by-Step)\" class=\"read-more\" href=\"https:\/\/cpanelfree.com\/blog\/how-to-host-ghost-cms-mysql-nginx-ubuntu-vps\/\" aria-label=\"Read more about How to Host Ghost CMS with MySQL and Nginx on Ubuntu VPS (Step-by-Step)\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":4536,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-4465","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-web-hosting-news"],"_links":{"self":[{"href":"https:\/\/cpanelfree.com\/blog\/wp-json\/wp\/v2\/posts\/4465","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cpanelfree.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cpanelfree.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cpanelfree.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cpanelfree.com\/blog\/wp-json\/wp\/v2\/comments?post=4465"}],"version-history":[{"count":1,"href":"https:\/\/cpanelfree.com\/blog\/wp-json\/wp\/v2\/posts\/4465\/revisions"}],"predecessor-version":[{"id":4484,"href":"https:\/\/cpanelfree.com\/blog\/wp-json\/wp\/v2\/posts\/4465\/revisions\/4484"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cpanelfree.com\/blog\/wp-json\/wp\/v2\/media\/4536"}],"wp:attachment":[{"href":"https:\/\/cpanelfree.com\/blog\/wp-json\/wp\/v2\/media?parent=4465"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cpanelfree.com\/blog\/wp-json\/wp\/v2\/categories?post=4465"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cpanelfree.com\/blog\/wp-json\/wp\/v2\/tags?post=4465"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}