Step 6: Setup WordPress Folder
By default, Apache will point to files located in /var/www/html/
While we can choose to have this as the folder for our WordPress installation, it is probably better to make a different folder.
Apache files for websites are usually located in /var/www/
Change into the /var/www/ directory
cd /var/www/
We will create our WordPress folder can call it our_wordpress_site.
sudo mkdir our_wordpress_site
Now that we have the folder for the later WordPress installation, let’s continue with setting up Apache
Step 7: Setup Apache Configuration
We should make sure all Apache configurations are correct, to prevent problems later.
Go to the folder where Apache website config files are located. It happens to be located in /etc/apache2/sites-available/
cd /etc/apache2/sites-available/
Next, you should see just two config files assuming you just installed Apache. The files should be 000-default.conf and default-ssl.conf. We will only modify default.conf. default-ssl.conf is a config file for using HTTPS, but we will not do that in this article.
First, copy 000-default.conf so that we can always refer back to the original in case we make mistakes.
I will call our copy original_default.conf
sudo cp 000-default.conf original_000-default.conf
Now for actually editing the 000-default.conf file. We only need to change the DocumentRoot directive and add a <Directory> section.
Edit the file and just modify the file and make the section look like:
sudo vim 000-default.conf
DocumentRoot /var/www/our_wordpress_site/ <Directory /var/www/our_wordpress_site/> Options Indexes FollowSymLinks AllowOverride All </Directory>
Here you can see at what the 000-default.conf should look like for your WordPress site on a VPS without a domain name.
Step 8: Restart Apache
After editing the 000-default.conf file, we need to restart Apache in order for the changes to be updated.
sudo service apache2 restart
Step 9: Enable Apache Mod Rewrite
In order for permalinks to work in WordPress, you need to have an Apache mod called rewrite to be enabled. This is especially true if you change the permalink structure after the initial install.
Here is how you enable rewrite:
sudo a2enmod rewrite
Now restart Apache again for the changes to come into effect.
sudo service apache2 restart
Step 10: Download WordPress Zip File From WordPress.org
Now, finally, we can download the actual WordPress files we will use for our site. Go to https://wordpress.org/download/ and look for a blue button that says “Download WordPress”. The latest file will likely be located at https://wordpress.org/latest.zip
Next, we need to change in the directory we made earlier for our WordPress install.
cd /var/www/our_wordpress_site
Now, download the WordPress zip file
sudo wget https://wordpress.org/latest.zip
Step 11: Unzip And Move The WordPress Files To The Top Of Our WordPress Folder
In order to use the files inside the zip file, we will need to unzip them. Do that now:
sudo unzip latest.zip
After unzipping lastest.zip, you should then see the folder called wordpress.
Technically, we could have our wordpress site at http://123.456.789.0/wordpress/ but I will assume we want to have the site at the root level, http://123.456.789.0, that is to say, have the WordPress site at http://123.456.789.0.
In order to do this, we need to change into the wordpress folder, and move all of the WordPress files up one level.
Change into the wordpress folder.
cd wordpress
You should see some files and folders which include:
index.php readme.html wp-admin wp-comments-post.php wp-content wp-includes wp-load.php wp-mail.php wp-signup.php xmlrpc.php license.txt wp-activate.php wp-blog-header.php wp-config-sample.php wp-cron.php wp-links-opml.php wp-login.php wp-settings.php wp-trackback.php
Now, we will move all those files up one directory
sudo mv * ../
Next, change directories up one level
cd ../
Now, we will delete the empty folder called wordpress.
sudo rmdir wordpress
Finally, delete the latest.zip file since we no longer need it.
sudo rm latest.zip
Step 12: Setup The Permissions And Ownerships Of Our WordPress Folder
The WordPress install will not work unless the files and folders have the appropriate permissions. We will give all files and folders the permissions 755 which means the owner can read,write, and execute files; the group and other users (everyone on the Internet looking at your site) will be able to read and execute files.
Change into the /var/www/ directory
cd /var/www/
Give all files in the our_wordpress_site folder, permissions 755
sudo chmod -R 755 our_wordpress_site
Change all files and folders within our_wordpress_site to have owner www-data and group www-data
sudo chown -R www-data:www-data our_wordpress_site
For information about www-data, read this.
To confirm that we setup the ownership and permissions correctly, you can type this command:
ls -la
You should see a line with something like:
drwxr-xr-x 5 www-data www-data 4096 Apr 26 22:51 our_wordpress_site
You will see similar output for files using ls -la inside the our_wordpress_site folder
This article is continued on the next page.
🚀 Embark on an Epic Time-Travel Adventure with Watson! 🐕🦖🎨
Take a journey through time with Watson the Time-Travelling Dog: Dogs and Dinosaurs Adventure Coloring Book 1.
Join Watson and his dog brother Sherlock as they meet dinosaurs, make new friends, and embark on an unforgettable adventure! Perfect for kids, dog lovers, and coloring book enthusiasts alike.
Why you'll love it:
- Engaging, fun-filled story
- Beautiful illustrations to color
- Ideal for family fun or a thoughtful gift
Ready for an adventure that sparks creativity and fun? 📖 Grab your copy today and let the time-traveling excitement begin!
Get your book now 👇
I quite like reading through an article that can make people think.
Also, many thanks for allowing for me to comment!
Thanks for the nice comment! I hope you enjoy more articles on this site too!