Starting an Online Store with WooCommerce on a Dedicated Server
Introduction
This guide walks you through launching a WooCommerce-powered store on a ServerStadium dedicated server (or ServerStadium VM) running Ubuntu 24.04. You’ll install WordPress, add WooCommerce, enable SSL with Let’s Encrypt, configure payments and email, and apply easy performance tweaks—perfect for small businesses that need a fast, affordable, and reliable storefront.
Prerequisites
- A ServerStadium dedicated server (Ubuntu 24.04 recommended) and a domain pointed to your server’s IP.
- SSH access with a sudo-capable user.
- An email address for Let’s Encrypt notifications, and an SMTP provider (or WordPress SMTP plugin) for order emails.
Option A: LAMP (Apache) Quick Start
1) Install packages
sudo apt update && sudo apt -y upgrade
sudo apt -y install apache2 mysql-server \
php php-fpm php-mysql php-curl php-xml php-gd php-zip php-mbstring php-intl php-bcmath \
unzip curl
sudo a2enmod rewrite
sudo systemctl enable --now apache2 mysql
2) Secure MySQL and create the store database
sudo mysql_secure_installation
sudo mysql -e "CREATE DATABASE shopdb DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci;"
sudo mysql -e "CREATE USER 'shopuser'@'localhost' IDENTIFIED BY 'ChangeThisStrongPassword!';"
sudo mysql -e "GRANT ALL PRIVILEGES ON shopdb.* TO 'shopuser'@'localhost'; FLUSH PRIVILEGES;"
3) Download and place WordPress
cd /tmp
curl -LO https://wordpress.org/latest.tar.gz
tar -xzf latest.tar.gz
sudo rsync -a wordpress/ /var/www/html/
sudo chown -R www-data:www-data /var/www/html
sudo find /var/www/html -type d -exec chmod 755 {} \;
sudo find /var/www/html -type f -exec chmod 644 {} \;
4) Apache vHost (replace example.com
)
sudo tee /etc/apache2/sites-available/wordpress.conf >/dev/null <<'EOF'
<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/html
<Directory /var/www/html>
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/wp_error.log
CustomLog ${APACHE_LOG_DIR}/wp_access.log combined
</VirtualHost>
EOF
sudo a2ensite wordpress.conf
sudo systemctl reload apache2
5) Configure WordPress
cd /var/www/html
cp wp-config-sample.php wp-config.php
sed -i "s/database_name_here/shopdb/; s/username_here/shopuser/; s/password_here/ChangeThisStrongPassword!/" wp-config.php
curl -s https://api.wordpress.org/secret-key/1.1/salt/ | sudo tee -a wp-config.php >/dev/null
sudo chown www-data:www-data wp-config.php
6) Enable HTTPS (Let’s Encrypt)
sudo apt -y install certbot python3-certbot-apache
sudo certbot --apache -d example.com -d www.example.com --redirect -m you@example.com --agree-tos -n
Option B: LEMP (Nginx) Quick Start
1) Install packages
sudo apt update
sudo apt -y install nginx mysql-server \
php-fpm php-mysql php-curl php-xml php-gd php-zip php-mbstring php-intl php-bcmath \
unzip curl
sudo systemctl enable --now nginx mysql
2) Create database (reuse the mysql
commands from LAMP step 2).
3) Install WordPress files
cd /tmp
curl -LO https://wordpress.org/latest.tar.gz
tar -xzf latest.tar.gz
sudo mkdir -p /var/www/wordpress
sudo rsync -a wordpress/ /var/www/wordpress/
sudo chown -R www-data:www-data /var/www/wordpress
4) Nginx server block (replace example.com
)
sudo tee /etc/nginx/sites-available/wordpress >/dev/null <<'EOF'
server {
listen 80;
server_name example.com www.example.com;
root /var/www/wordpress;
index index.php index.html;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php-fpm.sock;
}
location ~* \.(png|jpg|jpeg|gif|ico|css|js|svg|webp)$ {
expires max;
access_log off;
}
}
EOF
sudo ln -s /etc/nginx/sites-available/wordpress /etc/nginx/sites-enabled/wordpress
sudo nginx -t && sudo systemctl reload nginx
5) Configure WordPress
cd /var/www/wordpress
cp wp-config-sample.php wp-config.php
sed -i "s/database_name_here/shopdb/; s/username_here/shopuser/; s/password_here/ChangeThisStrongPassword!/" wp-config.php
curl -s https://api.wordpress.org/secret-key/1.1/salt/ | sudo tee -a wp-config.php >/dev/null
sudo chown www-data:www-data wp-config.php
6) Enable HTTPS (Let’s Encrypt)
sudo apt -y install certbot python3-certbot-nginx
sudo certbot --nginx -d example.com -d www.example.com --redirect -m you@example.com --agree-tos -n
Finish WordPress Setup & Install WooCommerce
Visit https://example.com
, complete the WordPress installer, then install WooCommerce. The easiest path is WP-CLI (you can also use the WordPress dashboard).
# Install WP-CLI
cd ~
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
php wp-cli.phar --info && chmod +x wp-cli.phar && sudo mv wp-cli.phar /usr/local/bin/wp
# Go to your site root (Apache default shown; for Nginx use /var/www/wordpress)
cd /var/www/html
# Install and activate WooCommerce
sudo -u www-data wp plugin install woocommerce --activate
# Optional: install Stripe gateway (recommended)
sudo -u www-data wp plugin install woocommerce-gateway-stripe --activate
# Optional: install an SMTP plugin for reliable order emails
sudo -u www-data wp plugin install wp-mail-smtp --activate
In the WordPress dashboard go to WooCommerce → Settings and run the setup wizard (store address, currency, shipping). Then open WooCommerce → Settings → Payments to enable Stripe (or your preferred gateway) and connect your account. Configure WP Mail SMTP (or your SMTP plugin) with your provider’s credentials so order receipts and password resets are delivered reliably.
Essential Store Tweaks
- Permalinks: Go to Settings → Permalinks and choose “Post name,” then click Save.
- Image sizes: In Settings → Media, set reasonable sizes (e.g., large 1200px). Consider a compression plugin for faster product pages.
- PHP memory limit: For medium stores, consider raising to 256M:
echo "memory_limit = 256M" | sudo tee /etc/php/*/apache2/conf.d/99-memory.ini /etc/php/*/fpm/conf.d/99-memory.ini
sudo systemctl reload apache2 || sudo systemctl reload php*-fpm
- Caching: Simple page caching helps. Example (optional) via WP-CLI:
sudo -u www-data wp plugin install cache-enabler --activate
- Firewall: Allow web/SSH traffic:
sudo ufw allow OpenSSH && sudo ufw allow 80 && sudo ufw allow 443 && sudo ufw enable
Backups (Quick Script)
Back up files and database nightly. Adjust paths if you used Nginx root (/var/www/wordpress
).
sudo mkdir -p /opt/shop-backups
sudo tee /opt/shop-backups/backup.sh >/dev/null <<'EOF'
#!/usr/bin/env bash
set -e
TS=$(date +%F-%H%M)
SITE_ROOT="/var/www/html" # or /var/www/wordpress
DB_NAME="shopdb"
DB_USER="shopuser"
DB_PASS="ChangeThisStrongPassword!"
mkdir -p /opt/shop-backups/${TS}
mysqldump -u ${DB_USER} -p${DB_PASS} ${DB_NAME} | gzip > /opt/shop-backups/${TS}/db.sql.gz
tar -czf /opt/shop-backups/${TS}/wp-files.tgz -C "${SITE_ROOT}" .
# Keep 14 days
find /opt/shop-backups -maxdepth 1 -type d -mtime +14 -exec rm -rf {} \; 2>/dev/null || true
EOF
sudo chmod +x /opt/shop-backups/backup.sh
echo "0 2 * * * root /opt/shop-backups/backup.sh" | sudo tee /etc/cron.d/shop-backup >/dev/null
Troubleshooting
- SSL issues: Make sure DNS A/AAAA records point to your server before running Certbot. Re-run with
--apache
or--nginx
. - Permalinks not working (Apache): Confirm
AllowOverride All
is set anda2enmod rewrite
is enabled; reload Apache. - Orders not emailing: Verify SMTP plugin settings; check WooCommerce → Status → Logs.
- 502/504 with Nginx: Check PHP-FPM:
systemctl status php*-fpm
; increaseclient_max_body_size
for large uploads if needed.
Ready to sell? Spin up a low-cost, instant ServerStadium dedicated server and launch today.
Conclusion
With WordPress and WooCommerce configured on ServerStadium, you’ve got a fast and dependable foundation for your online store—complete with SSL, payments, email, and backups. For more help or information about ServerStadium services, visit our knowledge base or the ServerStadium website.