Run your Wordpress site locally on Ubuntu
Download a Wordpress folder zip file from the official website
wget -c http://wordpress.org/latest.tar.gz
Unzip this zip file to a location of your choice
tar -xzvf latest.tar.gz -C /path/to/destination
remove the zip file
Go to your extracted folder location
cd /path/to/extracted/file/location
If you wish, you can rename the extracted folder
mv EXTRACTED_FOLDER_NAME_OLD_NAME EXTRACTED_FOLDER_NAME_NEW_NAME
Move the extracted folder to the Apache var/www/ folder
sudo mv EXTRACTED_FOLDER_NAME /var/www/
Assign the user you're currently logged on to ownership of the directory
sudo chown -R $USER :$USER /var/www/EXTRACTED_FOLDER_NAME
Give write permissions to the folder owner
sudo chmod -R 755 /var/www/EXTRACTED_FOLDER_NAME
Create a new configuration file
sudo nano /etc/apache2/sites-available/EXTRACTED_FOLDER_NAME.conf
Add the following configuration block to the configuration file
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName YOUR_DOMAIN
ServerAlias www.YOUR_DOMAIN
DocumentRoot /var/www/YOUR_DOMAIN
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Enable the configuration file
sudo a2ensite EXTRACTED_FOLDER_NAME.conf
test the configuration
sudo apache2ctl configtest
Expected outuput
Restart Apache to implement your changes
sudo systemctl restart apache2
Go To http://localhost/
You should be able to see this page
SOURCE