We’re here to help and answer any question you might have. We look forward to hearing from you.

Setting up WordPress on an AWS Ubuntu instance is a seamless process that involves installing a LAMP stack, configuring a MySQL database, and downloading WordPress. By connecting your domain and completing the installation, you can have a fully functional WordPress website hosted on AWS, ready to be customized and secured to your liking.


DAStek logo

What will you do

  1. Installing Apache 2.4, PHP 7.2, Mysql Server for WordPress
  2. Changing Ownership and Permission
  3. Installing latest WordPress on Ubuntu Server
  4. Configure MySQL database for WordPress
  5. Configure WordPress Security Key
  6. Creating Apache Virtual Host for WordPress


  1. AWS Account. 
  2. Amazon EC2 Ubuntu. 
  3. A user with sudo privilege command.

To get started, we assume that you have installed the EC2 instance already.

Step 1: Click Launch Instance and Select AMI Ubantu

Step 2: Install Apache 2

If you manage your website hosting using the WordPress platform, you will need to required installing a web server software. In this case, we use an Apache web server  to manage our WordPress virtual hosting.

To begin the installation of Apache, type the following commands:

Command 1sudo apt update
Command 2sudo apt install apache2
Start Apache Serversudo systemctl start apache2
Stop Apache Serversudo systemctl stop apache2
Restart Apache Serversudo systemctl restart apache2

Step 3: Install PHP

WordPress has made of using PHP language, which makes PHP very important language in WordPress websites to enable static and dynamic content.  At this time, you can install PHP version to build your site on the WordPress platform.

To install latest PHP version, run the following commands.

Command 1sudo apt update
Command 2sudo add-apt-repository ppa:ondrej/php
Command 3
sudo apt install php8.0 php8.0-cli php8.0-common php8.0-mysql php8.0-gd php8.0-xml php8.0-mbstring php8.0-curl

Step 4: Install phpmyadmin

Command 1sudo apt update
Command 2

sudo apt install phpmyadmin

Command 3

sudo systemctl status mysql


Create new user for phpmyadmin

Command 1sudo mysql -u root -p
Command 2CREATE USER ‘newuser’@’localhost’ IDENTIFIED BY ‘password’;
Command 3




Command 4sudo nano /etc/phpmyadmin/config.inc.php
Command 5Add following lines after $cfg[‘Servers’][$i][‘auth_type’] = ‘cookie’;
¬†$cfg[‘Servers’][$i][‘user’] = ‘newuser’;
¬†$cfg[‘Servers’][$i][‘password’] = ‘password’;
Command 6sudo service apache2 restart

Step 5: Modify phpinfo variables

Command 1sudo vim /etc/php/8.0/apache2/php.ini

As a result, Find for the specified list of variables below and set the value same as the following:

file_uploads = On
allow_url_fopen = On
memory_limit = 256M
upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 360

Step 6: Install WordPress

Download the latest WordPress from the official site using the command below:

Command 1

cd /tmp && wget https://wordpress.org/latest.tar.gz

Extract the compressed files.

Command 2

tar -zxvf latest.tar.gz

Next, move the entire extracted files to your root document directory, type the command:

Command 3

sudo mv wordpress /var/www/wordpress

Then open root document directory using:

Command 4

cd /var/www/wordpress/

Command 5

sudo vim .htaccess

Add these lines to htaccess file

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

Command 6

sudo mv wp-config-sample.php wp-config.php

Command 7

sudo chown -R www-data:ubuntu /var/www/wordpress

Command 8

sudo find /var/www/wordpress/ -type d -exec chmod 755 {} \;

Command 9

sudo find /var/www/wordpress/ -type f -exec chmod 644 {} \;

Command 10

sudo chmod 600 /var/www/wordpress/wp-config.php

Command 11

sudo chmod 600 /var/www/wordpress/.htaccess

Step 7: Setup WP Database

In this case, we are going to connect our WordPress website on the MySQL database. To do this, open the WordPress configuration file, type command:

Command 1

sudo vim /var/www/wordpress/wp-config.php 

  • Set Database details for wordpress.

  • Set security keys by visiting and copying the response -https://api.wordpress.org/secret-key/1.1/salt/ OR curl -s https://api.wordpress.org/secret-key/1.1/salt/

  • Paste it in wp-config.php – (sudo vim /var/www/wordpress/wp-config.php).¬†

Step 8: Create Apache Virtual host for wordpress

To add an Apache virtual host for WordPress, Go to the Apache2 virtual configuration directory, type command:

Command 1

cd /etc/apache2/sites-available

Command 2sudo a2dissite 000-default.conf
Command 3sudo systemctl reload apache2
Command 4sudo vim wordpress.conf

Copy the following virtual host configuration file below and change the domain name and also the path location for root document directory.


<VirtualHost *:80>
ServerAdmin admin@example.com
DocumentRoot /var/www/wordpress
ServerName example.com
ServerAlias www.example.com

<Directory /var/www/wordpress/>
Options +FollowSymlinks
AllowOverride All
Require all granted

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

Command 5sudo a2ensite wordpress.conf
Command 6sudo a2enmod rewrite
Command 7sudo apache2ctl configtest
results : SYNTAX:OK
Command 8sudo service apache2 restart

Trust and Worth

Our Customers

We are having a diversified portfolio and serving customers in the domains namely Sports Management, Online Laundry System, Matrimonial, US Mortgage, EdTech and so on.

Would you like to start a project with us?

DAStek team would be happy to hear from you and would love to turn your ‚ÄėImaginations to Reality‚Äô.