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.
WordPress setup on AWS AMI - Ubuntu
What will you do
- Installing Apache 2.4, PHP 7.2, Mysql Server for WordPress
- Changing Ownership and Permission
- Installing latest WordPress on Ubuntu Server
- Configure MySQL database for WordPress
- Configure WordPress Security Key
- Creating Apache Virtual Host for WordPress
Requirements
- AWS Account.
- Amazon EC2 Ubuntu.
- 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 1 | sudo apt update |
Command 2 | sudo apt install apache2 |
Start Apache Server | sudo systemctl start apache2 |
Stop Apache Server | sudo systemctl stop apache2 |
Restart Apache Server | sudo 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 1 | sudo apt update |
Command 2 | sudo 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 1 | sudo apt update |
Command 2 | sudo apt install phpmyadmin |
Command 3 | sudo systemctl status mysql |
Create new user for phpmyadmin | ||||||||||||||||
|
Step 5: Modify phpinfo variables
Command 1 | sudo 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> |
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 2 | sudo a2dissite 000-default.conf |
Command 3 | sudo systemctl reload apache2 |
Command 4 | sudo 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> <Directory /var/www/wordpress/> ErrorLog ${APACHE_LOG_DIR}/error.log |
Command 5 | sudo a2ensite wordpress.conf |
Command 6 | sudo a2enmod rewrite |
Command 7 | sudo apache2ctl configtest results : SYNTAX:OK |
Command 8 | sudo 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’.