set up WordPress with SSL on Ubuntu Server using Apache.


 

set up WordPress with SSL on Ubuntu Server using Apache. I’ll make it clear and production-ready. This assumes you already have Apache installed on your Ubuntu Server.


1. Prerequisites

  • Ubuntu Server (latest LTS, e.g., 24.04)

  • Apache installed and running

  • MySQL installed and configured

  • Domain name pointing to your server’s IP

  • UFW firewall enabled with Apache allowed


2. Install PHP and Required Modules

WordPress requires PHP 8+ and some modules:

sudo apt update
sudo apt install php php-mysql php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zip libapache2-mod-php -y

Restart Apache to apply changes:

sudo systemctl restart apache2

3. Create a MySQL Database for WordPress

Log in to MySQL:

sudo mysql -u root -p

Inside MySQL, run:

CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'wordpressuser'@'localhost' IDENTIFIED BY 'StrongPasswordHere';
GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpressuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Replace StrongPasswordHere with a secure password.


4. Download and Set Up WordPress

Go to /var/www/ and download WordPress:

cd /var/www/
sudo wget https://wordpress.org/latest.tar.gz
sudo tar xzvf latest.tar.gz
sudo mv wordpress html
sudo chown -R www-data:www-data /var/www/html
sudo chmod -R 755 /var/www/html

Now your website files are in /var/www/html.


5. Configure Apache for WordPress

Create a new Apache config file:

sudo nano /etc/apache2/sites-available/wordpress.conf

Add:

<VirtualHost *:80>
    ServerName yourdomain.com
    ServerAlias www.yourdomain.com
    DocumentRoot /var/www/html
    <Directory /var/www/html>
        AllowOverride All
    </Directory>
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Enable the site and rewrite module:

sudo a2ensite wordpress.conf
sudo a2enmod rewrite
sudo systemctl restart apache2

6. Enable SSL with Let’s Encrypt

Install Certbot:

sudo apt install certbot python3-certbot-apache -y

Generate SSL certificate:

sudo certbot --apache -d yourdomain.com -d www.yourdomain.com

Follow the prompts. Certbot will automatically configure Apache for HTTPS.

Check renewal:

sudo certbot renew --dry-run

7. Complete WordPress Installation

  1. Open your browser: https://yourdomain.com

  2. Follow the WordPress setup wizard:

    • Language

    • Database name: wordpress

    • Username: wordpressuser

    • Password: StrongPasswordHere

    • Table prefix: wp_ (default)

  3. Create admin account and finish setup.


Result: You now have a secure WordPress website hosted on Apache with SSL on Ubuntu Server. Your site will be accessible via https://yourdomain.com.



Comments

Popular posts from this blog

Differences Between Ubuntu 24.04.2 LTS and Ubuntu 25.04

Kapardak Bhasma: A Comprehensive Review and use

Vanga Bhasma: A Traditional Ayurvedic Metallic Formulation and use