Loading...

Knowledge Base

Purchase a HostGator Self-Managed VPS with WooCommerce (WordPress) Installation

WooCommerce adds full ecommerce capability to a WordPress site, covering everything from product catalogs and inventory tracking to checkout, shipping, and tax rules. It's built for merchants who want to sell physical or digital goods without leaving the WordPress platform they already know.

Key Benefits of WooCommerce (WordPress) on a Self-Managed VPS

A Self-Managed VPS hands the resources, security posture, and configuration of your store entirely to you, instead of splitting them across a server shared with other sites. That means you can tune the environment around WooCommerce specifically, absorb bigger traffic surges without slowing down, and install any plugin or theme your store calls for on your own timeline. For businesses planning to grow, that level of control tends to matter more over time, not less.

What You Can Do With WooCommerce (WordPress)

Stores of nearly any size run on WooCommerce. Once it's installed, you're able to:

  • Sell Physical and Digital Products: List and manage nearly any product type, shipped or downloaded.
  • Customize Your Store: Draw from a large library of themes and plugins covering payments, shipping, and marketing.
  • Manage Orders and Inventory: Keep an eye on sales, stock, and customer records from a single dashboard.
  • Combine Content and Commerce: Run your storefront and your site's content on the same install.
  • Scale as You Grow: Add capacity or features later as demand on your store changes.

Between the plugin ecosystem and the flexibility of running on your own VPS, WooCommerce gives you room to build a store that fits your business rather than the other way around.

How to Purchase a Self-Managed VPS with WooCommerce (WordPress) Installation

To use WooCommerce (WordPress) on HostGator, you first need to buy a Self-Managed VPS plan. Here is how to do it:

Pre-configured Setup

Self-Managed VPS - Pre-configured Setup
Not sure which VPS setup is right for you? That's exactly what Pre-configured Setup is for. You'll find this option near the top of the HostGator Self-Managed VPS purchase page, and it takes the guesswork out of getting started. Just tell us what you're building—a WordPress Site, an AI Agent/Claude Code project, a Dev/Staging environment, or an eCommerce Store—and we'll automatically select the right plan, operating system, and template to match.
  • Great option if you're new to VPS or want a fast, easy setup
  • Get the recommended configuration for your project right away
  • No need to figure out the technical details yourself
  • Full flexibility to adjust settings later on
Try Pre-configured Setup and have your HostGator Self-Managed VPS ready to go in minutes!
  1. Open https://www.hostgator.com/vps-hosting in your browser.
  2. Pick the plan you want and click Choose Plan.

    Self-Managed VPS - Choose Plan
     

  3. Pick a Data Center location.

    Self-Managed VPS - Data Center Locations
     

  4. On the Cart page, you can set up your server the way you want:
    1. Hardware:
      1. Pre-selected:

        You can change to a different Self-Managed VPS plan here.

        Self-Managed VPS - Pre-selected Hardware
         

      2. Configure:

        Click Configure if you want to build your own custom package.

        Self-Managed VPS - Configure
         

    2. Software:
      1. Click the Application tab.
      2. Choose WooCommerce (WordPress).

        Self-Managed VPS - WooCommerce (WordPress) Software
         

      3. In the pop-up, click Confirm.

        Self-Managed VPS - WooCommerce (WordPress) -Confirm
         

  5. Support & Security:

    You can add Premium Support here for faster help and quicker replies.This is Optional.

    Self-Managed VPS - Premium Support
     

  6. AI Credits:

    Add a HostGator AI Credits package to connect your application to top LLM providers through one API key and a single bill. This step is optional.

    Self-Managed VPS - AI Credits
     

  7. In Advanced options, you can set these up if you want:
    • Extra IPs: Add more IP addresses for an extra cost. The price changes based on how many you add.
    • Hostname: Give your server a custom name. This is optional.
    • SSH Key: If you want to log in without a password, add your SSH public key here. This is optional.

      Self-Managed VPS - Advanced Options
       

  8. Choose a billing term, check your Order Summary, then click Continue to Checkout.

    Self-Managed VPS -Initial- Order Summary
     

  9. Check your HostGator cart. Remove any add-ons you don't want, then click Continue to Checkout again.

    Self-Managed VPS - Continue to Checkout
     

  10. On the Checkout page, do the following:

    If you are new to HostGator:

    1. Fill in your billing information and contact details. If you don't want marketing emails, uncheck the box at the bottom.

      Self-Managed VPS - Billing Information
       

    2. Create a password for your account.

      Self-Managed VPS - Account Password
       

    3. Choose how you want to pay—Credit Card or PayPal—and enter your payment details.

      Self-Managed VPS - Payment Method Options
       

    If you already have an account, your HostGator login details will show up once you log in to your Customer Portal. If you are not logged in, click Log In.

    Self-Managed VPS - HostGator Login
     

  11. Review your payment method and order total. If you have a promo code, click Add Promo Code and enter your code. If you need to make changes, click Edit or Add Payment Method. When everything looks correct, click Submit Payment to complete your purchase. By clicking Submit Payment, you agree to the Auto Renewal Terms, Terms of Service, Cancellation Policy, and Privacy Notice.

    Self-Managed VPS - Submit Payment
     

After checkout, your Self-Managed VPS will begin setting up. Once it’s ready, you can find it under the Hosting tab in your Customer Portal.

Accessing Your WooCommerce Dashboard

Your WooCommerce server is up and running. This guide covers everything from your first login to day-to-day store management.

For security, this image never ships with a hardcoded password. Instead, unique credentials are generated automatically the first time your server boots.

Follow the steps below to get into your store.

Step 1: Connect to Your Server

  1. Log in to your Customer Portal.
  2. From the left-hand menu, navigate to Hosting and select My Plans.

    Customer Portal - Hosting tab - View Details
     

  3. Locate the server you want to manage, then click View Details in the bottom-left corner to expand the section and access additional server information.

    Customer Portal - Hosting tab - View Details
     

  4. Click the Reset Password button.

    Customer Portal - Hosting tab - View Details - Reset Password
     

  5. In the pop-up window, type your new root password, then click Reset Password again to confirm and save the changes.

    Customer Portal - Hosting tab - View Details - Reset Password
     

  1. Connect to your VPS via SSH.
    Open your computer's terminal (or an SSH client like PuTTY) and run the following command to log into your server as the administrator, using your server's public IP address:
    ssh root@your_server_ip
    	
    Follow the prompts and enter the new root password you created in the step above.
  2. If you ever need to quickly review the system's deployment notes directly inside your server terminal, you can print out the original README file by running:
    cat /root/README.md

Step 2: Retrieve Your Admin Password

Now retrieve the auto-generated password your server created for the admin account.

  1. Look at the MOTD (Message of the Day) text that appears immediately upon logging into SSH. It shows you exactly where your credentials are.
  2. Run the following command in your terminal to view your admin credentials:
    sudo cat /var/www/html/.env

    Example Output:

    Last login: Thu Jun 25 14:14:16 2026 from 180.190.7.63
    root@server-123456:~# sudo cat /var/www/html/.env
    # WooCommerce / WordPress runtime credentials
    # Read this file to get your admin password:
    #   cat /var/www/html/.env
    WP_ADMIN_USER=admin
    WP_ADMIN_PASSWORD=rcUFObLZ0qk7R04JuBzhQM
    [email protected]
    WP_SITEURL=https://12.1.230.123.166
    WP_DB_PASSWORD=QUWtfsin7sbgLGe2m0sPJpu

Step 3: Access Your Dashboard

With your credentials in hand, open a browser and head to your site.

  • WordPress Admin Panel: https://server-ip/wp-admin or (/wp-login.php)

    Self-Managed VPS - WooCommerce WP Admin Login
     

  • Your Storefront: https://server-ip/shop

    Self-Managed VPS - WooCommerce Store Login
     

  • Main Homepage: https://server-ip/

    Self-Managed VPS - WooCommerce WP Admin Login
     

Essential Management Commands

Your entire server stack can be managed straight from the command line. Below are the shortcuts you'll reach for most often when maintaining your store.

  1. Managing System Services

    Keep your web server, database, and PHP processors running smoothly:

    • Check Web Server Status:
      systemctl status nginx
    • Safely Reload Web Config (No Downtime):
      nginx -t && systemctl reload nginx
    • Restart PHP Processors:
      systemctl restart php8.3-fpm
    • Access Database Shell:
      mysql -u root
  2. Managing WordPress via Command Line (WP-CLI)

    The web browser isn't the only way to update your site. The built-in wp command lets you manage your store straight from the terminal:

    • List Installed Plugins:
      wp plugin list --path=/var/www/html/wordpress --allow-root
    • Update All Plugins at Once:
      wp plugin update --all --path=/var/www/html/wordpress --allow-root
    • Force Process Scheduled Actions (Cron):
      wp cron event run --due-now --path=/var/www/html/wordpress --allow-root
  3. Monitoring Live Logs

    Watch what's happening on your server as it happens:

    • Watch Web Traffic & Errors:
      tail -f /var/log/nginx/access.log /var/log/nginx/error.log
    • View WooCommerce Logs:
      tail -100 /var/log/woocommerce/woocommerce.log

Additional Information and Examples

You can run cat /root/README.md to see more information and useful commands:

Example Output:
root@server-123456:~# cat /root/README.md
# WooCommerce (WordPress)

## Description

WooCommerce is an ecommerce platform that lets you add a fully featured online store to any WordPress website.
It supports product listings, inventory management, payment processing, shipping, and tax configuration,
giving you everything you need to sell physical or digital products directly from your site.

---

## Image contents

This template installs and configures:

- WordPress (latest) from the official WordPress.org download
- WooCommerce plugin (latest stable) pre-downloaded and activated on first boot
- MariaDB 10.11 as the local database backend
- Nginx as the web server - handles TLS termination and serves static files
- PHP 8.3-FPM with all extensions required by WooCommerce (curl, gd, intl, mbstring, mysqli, soap, xml, zip, bcmath, imagick)
- WP-CLI 2.12.0 installed globally at `/usr/local/bin/wp`
- certbot installed at `/opt/certbot/` for automatic TLS certificate provisioning
- UFW firewall rules for SSH (22), HTTP (80), and HTTPS (443)
- `wp-config.php` hardened above webroot at `/var/www/html/wp-config.php` (mode 0600)
- Operator credentials store at `/var/www/html/.env` (mode 0600)
- First-boot initialization script at `/var/lib/cloud/scripts/per-instance/001_onboot`
- Logrotate config at `/etc/logrotate.d/woocommerce`

---

## Services

| Service | Ports | Purpose |
|---------|-------|---------|
| Nginx | 80, 443 | TLS termination, static files, front controller |
| PHP-FPM 8.3 | unix socket | PHP execution for WordPress / WooCommerce |
| MariaDB | local | Database backend for WordPress |
| OpenSSH | 22 | Remote access |

Ports are protected using UFW.

---

## WordPress / WooCommerce configuration

The default WordPress configuration file is `/var/www/html/wp-config.php`.

Key settings include:

- `DB_NAME = wordpress` - WordPress database
- `DB_USER = wpuser` - dedicated database user
- `DB_PASSWORD` - placeholder, replaced at first boot from `.env`
- `DB_HOST = localhost` - local MariaDB instance
- DocumentRoot - `/var/www/html/wordpress`
- WooCommerce plugin - `/var/www/html/wordpress/wp-content/plugins/woocommerce/`

The Nginx site config is at `/etc/nginx/sites-available/woocommerce`.

---

## First boot behavior

On the first boot, the cloud-init per-instance script `/var/lib/cloud/scripts/per-instance/001_onboot`:

- Detects the real public IP (via cloud metadata service, falling back to `hostname -I`)
- Requests a TLS certificate from Let's Encrypt for the **public IP address** using certbot; falls back to a self-signed certificate if certbot fails
- Writes the HTTPS nginx config (HTTP redirects to HTTPS; HTTPS terminates TLS and serves WordPress via PHP-FPM)
- Updates WordPress `siteurl` and `home` options in the database to `https://public-ip`
- Reads and applies `WP_ADMIN_PASSWORD`, `WP_ADMIN_USER`, and `WP_ADMIN_EMAIL` from `.env`
- Ensures WooCommerce is active and flushes rewrite rules with the real URL
- Restarts PHP-FPM and nginx

This guarantees that no fixed admin password is ever baked into the image.

---

## First-time access (How to use)

### How admin credentials work

This image **never bakes a fixed password** into the image. Instead:

1. During the image build, WordPress is installed with a throw-away placeholder password that is never written anywhere accessible.
2. The `.env` file is written with `WP_ADMIN_PASSWORD=CHANGEME_ON_BOOT` as a sentinel value.
3. On **first boot**, `001_onboot` detects the sentinel, generates a secure 24-character random password using `openssl rand`, updates the WordPress admin account in the database, and saves the real password back to `.env`.
4. The generated password is printed to the first-boot log. The MOTD (shown on every SSH login) tells you where to retrieve it.

**You do not need to set a password manually.** It is generated automatically.

-

### 1. Get your credentials after first boot

**On every SSH login the MOTD shows where credentials are stored:**
```
  - Admin Credentials ---------------------------
  Username  : admin
  Password  : sudo cat /var/www/html/.env
```

**Read the credentials file directly:**
```bash
sudo cat /var/www/html/.env
```

**Or check the first-boot log:**
```bash
sudo grep -A 6 "First Boot Credentials" /var/log/cloud-init-output.log
```

-

### 2. If the password in `.env` is still CHANGEME_ON_BOOT

The first-boot script did not run yet (can happen if cloud-init did not execute). Run it manually:

```bash
# Fix Windows line endings if needed (run once)
sudo sed -i 's/\r//' /var/lib/cloud/scripts/per-instance/001_onboot

# Run the first-boot script
sudo bash /var/lib/cloud/scripts/per-instance/001_onboot
```

Then check the password:
```bash
sudo grep 'WP_ADMIN_PASSWORD' /var/www/html/.env
```

-

### 3. Override with a custom password (optional)

If you want a specific password instead of the generated one, edit `.env` **before** first boot:

```bash
sudo nano /var/www/html/.env
```

Set your values:
```env
WP_ADMIN_USER=admin
WP_ADMIN_PASSWORD=YourChosenPassword123
[email protected]
WP_SITEURL=http://your-domain-or-ip
WP_DB_PASSWORD=changeme_on_first_boot
```

Save with `Ctrl+X`, `Y`, `Enter` - then run `001_onboot` and it will use your password instead of generating one.

-

### 4. Access your store

After the VM boots, access WooCommerce at:

| URL | Purpose |
|-----|---------|
| `https://server-ip/wp-admin` | WordPress / WooCommerce admin panel |
| `https://server-ip/wp-login.php` | WordPress login page |
| `https://server-ip/shop` | WooCommerce storefront |
| `https://server-ip/` | WordPress front page |

> **Note:** On first login you may be redirected to `wp-login.php`. Use an incognito/private browser window if you experience redirect issues during local testing.

---

## Manage

### Web Interface

| URL | Purpose |
|-----|---------|
| `https://server-ip/wp-admin` | WordPress / WooCommerce admin panel |
| `https://server-ip/shop` | WooCommerce storefront |
| `https://server-ip/` | WordPress front page |

### Nginx

```bash
# Check status
systemctl status nginx

# Reload config without downtime (safe - no dropped connections)
systemctl reload nginx

# Test config before reloading
nginx -t
```

### PHP-FPM

```bash
# Check status
systemctl status php8.3-fpm

# Restart
systemctl restart php8.3-fpm
```

### MariaDB

```bash
# Check status
systemctl status mariadb

# Open MySQL shell
mysql -u root

# Show all databases
mysql -u root -e "SHOW DATABASES;"

# Show wpuser grants
mysql -u root -e "SHOW GRANTS FOR 'wpuser'@'localhost';"
```

### UFW Firewall

```bash
# Check firewall status
ufw status verbose

# View active rules
ufw status numbered
```

### WordPress via WP-CLI

```bash
# List plugins
wp plugin list --path=/var/www/html/wordpress --allow-root

# Update all plugins
wp plugin update --all --path=/var/www/html/wordpress --allow-root

# Activate WooCommerce
wp plugin activate woocommerce --path=/var/www/html/wordpress --allow-root

# Run cron manually
wp cron event run --due-now --path=/var/www/html/wordpress --allow-root

# Check WordPress version
wp core version --path=/var/www/html/wordpress --allow-root

# List active themes
wp theme list --path=/var/www/html/wordpress --allow-root

# Update site URL (useful for local testing)
wp option update siteurl 'http://localhost:8080' --path=/var/www/html/wordpress --allow-root
wp option update home 'http://localhost:8080' --path=/var/www/html/wordpress --allow-root
```

### Logs

```bash
# Nginx error log
tail -f /var/log/nginx/error.log

# Nginx access log
tail -f /var/log/nginx/access.log

# WooCommerce log
tail -100 /var/log/woocommerce/woocommerce.log

# MariaDB log
journalctl -u mariadb -f

# Cloud-init first boot log
cat /var/log/cloud-init-output.log
```

---

## Security hardening

| Hardening | Detail |
|-----------|--------|
| UFW firewall | Only ports 22, 80, 443 open. Default deny all incoming |
| SSH rate limiting | Port 22 set to LIMIT - brute force protection |
| wp-config.php location | Moved above webroot - not accessible via browser |
| wp-config.php permissions | Mode `0600` - owner read only |
| .env permissions | Mode `0600` - owner read only |
| Credentials | Never baked into image - set at runtime via `.env` |

---

## Validation tests

The template includes a TAP test suite at `/root/app_test/main.t` that checks:

- PHP 8.3 is installed and PHP-FPM is enabled and active
- Nginx is enabled and active
- MariaDB is enabled and active
- WP-CLI is installed
- WordPress core files are present at `/var/www/html/wordpress`
- WooCommerce plugin files are present
- `wp-config.php` exists with mode `0600`
- `.env` file exists with mode `0600`
- Nginx woocommerce site is enabled in `sites-enabled`
- WordPress database exists in MariaDB
- First-boot script is in place
- UFW firewall is active

---


## Configuration files reference

| File | Purpose | Permissions |
|------|---------|-------------|
| `/var/www/html/wp-config.php` | WordPress DB and salt config | `0600` |
| `/var/www/html/.env` | Operator credentials for first-boot | `0600` |
| `/etc/nginx/sites-available/woocommerce` | Nginx site config (rewritten at first boot with HTTPS) | `0644` |
| `/etc/php/8.3/fpm/pool.d/www.conf` | PHP-FPM pool config | `0644` |
| `/var/lib/cloud/scripts/per-instance/001_onboot` | First-boot script | `0755` |
| `/var/log/woocommerce/woocommerce.log` | WooCommerce application log | `0640` |
| `/etc/logrotate.d/woocommerce` | Log rotation config | `0644` |

---

## Notes

- The WooCommerce plugin is pre-downloaded at build time and activated on first boot via WP-CLI.
- `wp-config.php` is intentionally placed above the webroot so it cannot be accessed via a browser.
- The `.env` file holds placeholder credentials - always replace before first boot.
- Nginx serves WordPress directly via PHP-FPM (no Apache). PHP-FPM runs as `www-data` on a unix socket at `/run/php/php8.3-fpm.sock`.
- The TLS certificate is issued for the server's **public IP address** (not hostname) so it works immediately without DNS configuration.
- On first boot, if Let's Encrypt cannot issue a certificate (NAT, rate limit), a self-signed cert is generated automatically. Replace it later with: `certbot certonly --ip-address IP`

---
## Links

- Manage: [Manage](http://localhost:8080/wp-admin)
- WordPress Documentation: [https://wordpress.org/documentation/](https://wordpress.org/documentation/)
- WooCommerce Documentation: [https://woocommerce.com/documentation/](https://woocommerce.com/documentation/)
- WP-CLI Documentation: [https://wp-cli.org/](https://wp-cli.org/)
- MariaDB 10.11 Documentation: [https://mariadb.com/kb/en/mariadb-10-11/](https://mariadb.com/kb/en/mariadb-10-11/)
- PHP 8.3 Documentation: [https://www.php.net/releases/8.3/](https://www.php.net/releases/8.3/)
- Ubuntu 24.04 LTS Release Notes: [https://wiki.ubuntu.com/NobleNumbat/ReleaseNotes](https://wiki.ubuntu.com/NobleNumbat

Loading...