{"id":764,"date":"2025-01-11T22:53:23","date_gmt":"2025-01-11T22:53:23","guid":{"rendered":"https:\/\/gratisvps.net\/blog\/?p=764"},"modified":"2025-01-11T22:53:23","modified_gmt":"2025-01-11T22:53:23","slug":"setting-up-a-wordpress-website-on-ubuntu-vps","status":"publish","type":"post","link":"https:\/\/gratisvps.net\/blog\/setting-up-a-wordpress-website-on-ubuntu-vps\/","title":{"rendered":"Setting Up a WordPress Website on Ubuntu VPS"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_85 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/gratisvps.net\/blog\/setting-up-a-wordpress-website-on-ubuntu-vps\/#Setting_Up_a_WordPress_Website_on_Ubuntu_VPS\" >Setting Up a WordPress Website on Ubuntu VPS<\/a><ul class='ez-toc-list-level-2' ><li class='ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/gratisvps.net\/blog\/setting-up-a-wordpress-website-on-ubuntu-vps\/#Introduction\" >Introduction<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/gratisvps.net\/blog\/setting-up-a-wordpress-website-on-ubuntu-vps\/#Prerequisites\" >Prerequisites<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/gratisvps.net\/blog\/setting-up-a-wordpress-website-on-ubuntu-vps\/#Step_1_Connect_to_Your_VPS\" >Step 1: Connect to Your VPS<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/gratisvps.net\/blog\/setting-up-a-wordpress-website-on-ubuntu-vps\/#Step_2_Update_Your_System\" >Step 2: Update Your System<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/gratisvps.net\/blog\/setting-up-a-wordpress-website-on-ubuntu-vps\/#Step_3_Install_Apache\" >Step 3: Install Apache<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/gratisvps.net\/blog\/setting-up-a-wordpress-website-on-ubuntu-vps\/#Step_4_Install_MySQL\" >Step 4: Install MySQL<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/gratisvps.net\/blog\/setting-up-a-wordpress-website-on-ubuntu-vps\/#Step_5_Install_PHP\" >Step 5: Install PHP<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/gratisvps.net\/blog\/setting-up-a-wordpress-website-on-ubuntu-vps\/#Step_6_Test_PHP\" >Step 6: Test PHP<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/gratisvps.net\/blog\/setting-up-a-wordpress-website-on-ubuntu-vps\/#Step_7_Create_a_MySQL_Database_for_WordPress\" >Step 7: Create a MySQL Database for WordPress<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/gratisvps.net\/blog\/setting-up-a-wordpress-website-on-ubuntu-vps\/#Step_8_Download_WordPress\" >Step 8: Download WordPress<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/gratisvps.net\/blog\/setting-up-a-wordpress-website-on-ubuntu-vps\/#Step_9_Configure_WordPress\" >Step 9: Configure WordPress<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/gratisvps.net\/blog\/setting-up-a-wordpress-website-on-ubuntu-vps\/#Step_10_Set_Permissions\" >Step 10: Set Permissions<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/gratisvps.net\/blog\/setting-up-a-wordpress-website-on-ubuntu-vps\/#Step_11_Enable_Apache_Modules\" >Step 11: Enable Apache Modules<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/gratisvps.net\/blog\/setting-up-a-wordpress-website-on-ubuntu-vps\/#Step_12_Complete_WordPress_Installation\" >Step 12: Complete WordPress Installation<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-16\" href=\"https:\/\/gratisvps.net\/blog\/setting-up-a-wordpress-website-on-ubuntu-vps\/#Step_13_Secure_Your_WordPress_Site\" >Step 13: Secure Your WordPress Site<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-17\" href=\"https:\/\/gratisvps.net\/blog\/setting-up-a-wordpress-website-on-ubuntu-vps\/#Step_14_Set_Up_a_Domain_Name_Optional\" >Step 14: Set Up a Domain Name (Optional)<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-18\" href=\"https:\/\/gratisvps.net\/blog\/setting-up-a-wordpress-website-on-ubuntu-vps\/#Conclusion\" >Conclusion<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-19\" href=\"https:\/\/gratisvps.net\/blog\/setting-up-a-wordpress-website-on-ubuntu-vps\/#Next_Steps\" >Next Steps<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-20\" href=\"https:\/\/gratisvps.net\/blog\/setting-up-a-wordpress-website-on-ubuntu-vps\/#Additional_Resources\" >Additional Resources<\/a><\/li><\/ul><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h1 id=\"tutorial-setting-up-a-wordpress-website-on-ubuntu-vps\"><span class=\"ez-toc-section\" id=\"Setting_Up_a_WordPress_Website_on_Ubuntu_VPS\"><\/span>Setting Up a WordPress Website on Ubuntu VPS<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<h2 id=\"introduction\"><span class=\"ez-toc-section\" id=\"Introduction\"><\/span>Introduction<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>In this tutorial, we will walk through the process of setting up a WordPress website on a Virtual Private Server (VPS) using Ubuntu. We&#8217;ll use a LAMP stack (Linux, Apache, MySQL, PHP), and by the end, you&#8217;ll have a fully functional WordPress site ready to customize and populate with content.<\/p>\n\n<h3 id=\"prerequisites\"><span class=\"ez-toc-section\" id=\"Prerequisites\"><\/span>Prerequisites<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<ol start=\"1\">\n<li><strong>A VPS running Ubuntu 20.04 or later.<\/strong><\/li>\n<li><strong>SSH access to the server.<\/strong><\/li>\n<li><strong>A domain name (optional) for your WordPress site.<\/strong><\/li>\n<li><strong>Basic familiarity with the command line.<\/strong><\/li>\n<\/ol>\n<h2 id=\"step-1-connect-to-your-vps\"><span class=\"ez-toc-section\" id=\"Step_1_Connect_to_Your_VPS\"><\/span>Step 1: Connect to Your VPS<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>First, connect to your VPS using SSH. Open your terminal and run:<\/p>\n<pre><code class=\"lang-bash hljs language-bash\">ssh username@your_server_ip<\/code><\/pre>\n<p>Replace\u00a0<code>username<\/code>\u00a0with your actual username and\u00a0<code>your_server_ip<\/code>\u00a0with your VPS&#8217;s IP address.<\/p>\n<h2 id=\"step-2-update-your-system\"><span class=\"ez-toc-section\" id=\"Step_2_Update_Your_System\"><\/span>Step 2: Update Your System<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Before installing anything, make sure your system is up to date:<\/p>\n<pre><code class=\"lang-bash hljs language-bash\">sudo apt update &amp;&amp; sudo apt upgrade -y<\/code><\/pre>\n<h2 id=\"step-3-install-apache\"><span class=\"ez-toc-section\" id=\"Step_3_Install_Apache\"><\/span>Step 3: Install Apache<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Apache is a popular web server. To install it, run:<\/p>\n<pre><code class=\"lang-bash hljs language-bash\">sudo apt install apache2 -y<\/code><\/pre>\n<p>After installation, enable and start the Apache server:<\/p>\n<pre><code class=\"lang-bash hljs language-bash\">sudo systemctl <span class=\"hljs-built_in\">enable<\/span> apache2  \r\nsudo systemctl start apache2<\/code><\/pre>\n<p>You can verify that Apache is running by visiting\u00a0<code>http:\/\/your_server_ip<\/code>\u00a0in your web browser. You should see the Apache2 Ubuntu Default Page.<\/p>\n<h2 id=\"step-4-install-mysql\"><span class=\"ez-toc-section\" id=\"Step_4_Install_MySQL\"><\/span>Step 4: Install MySQL<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Next, we need a database server to store WordPress data. We&#8217;ll install MySQL:<\/p>\n<pre><code class=\"lang-bash hljs language-bash\">sudo apt install mysql-server -y<\/code><\/pre>\n<p>After installation, run the security script to set up the root password and secure your installation:<\/p>\n<pre><code class=\"lang-bash hljs language-bash\">sudo mysql_secure_installation<\/code><\/pre>\n<p>Follow the prompts to create a root password and remove any unnecessary users or databases.<\/p>\n<h2 id=\"step-5-install-php\"><span class=\"ez-toc-section\" id=\"Step_5_Install_PHP\"><\/span>Step 5: Install PHP<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>WordPress is built on PHP, so we need to install PHP and some necessary extensions:<\/p>\n<pre><code class=\"lang-bash hljs language-bash\">sudo apt install php php-mysql libapache2-mod-php php-curl php-xml php-mbstring php-zip -y<\/code><\/pre>\n<h2 id=\"step-6-test-php\"><span class=\"ez-toc-section\" id=\"Step_6_Test_PHP\"><\/span>Step 6: Test PHP<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>To test if PHP is working, create a simple\u00a0<code>info.php<\/code>\u00a0file in the web root directory:<\/p>\n<pre><code class=\"lang-bash hljs language-bash\"><span class=\"hljs-built_in\">echo<\/span> <span class=\"hljs-string\">\"&lt;?php phpinfo(); ?&gt;\"<\/span> | sudo <span class=\"hljs-built_in\">tee<\/span> \/var\/www\/html\/info.php<\/code><\/pre>\n<p>Visit\u00a0<code>http:\/\/your_server_ip\/info.php<\/code>\u00a0in your browser. You should see the PHP information page. Once you confirm it&#8217;s working, delete this file for security reasons:<\/p>\n<pre><code class=\"lang-bash hljs language-bash\">sudo <span class=\"hljs-built_in\">rm<\/span> \/var\/www\/html\/info.php<\/code><\/pre>\n<h2 id=\"step-7-create-a-mysql-database-for-wordpress\"><span class=\"ez-toc-section\" id=\"Step_7_Create_a_MySQL_Database_for_WordPress\"><\/span>Step 7: Create a MySQL Database for WordPress<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Now, let\u2019s create a database for your WordPress site. Log into MySQL:<\/p>\n<pre><code class=\"lang-bash hljs language-bash\">sudo mysql -u root -p<\/code><\/pre>\n<p>Create a new database and user for WordPress:<\/p>\n<pre><code class=\"lang-sql hljs language-sql\"><span class=\"hljs-keyword\">CREATE<\/span> DATABASE wordpress;\r\n<span class=\"hljs-keyword\">CREATE<\/span> <span class=\"hljs-keyword\">USER<\/span> <span class=\"hljs-string\">'wpuser'<\/span>@<span class=\"hljs-string\">'localhost'<\/span> IDENTIFIED <span class=\"hljs-keyword\">BY<\/span> <span class=\"hljs-string\">'password'<\/span>;\r\n<span class=\"hljs-keyword\">GRANT<\/span> <span class=\"hljs-keyword\">ALL<\/span> PRIVILEGES <span class=\"hljs-keyword\">ON<\/span> wordpress.<span class=\"hljs-operator\">*<\/span> <span class=\"hljs-keyword\">TO<\/span> <span class=\"hljs-string\">'wpuser'<\/span>@<span class=\"hljs-string\">'localhost'<\/span>;\r\nFLUSH PRIVILEGES;\r\nEXIT;<\/code><\/pre>\n<p>Replace\u00a0<code>'password'<\/code>\u00a0with a strong password of your choice.<\/p>\n<h2 id=\"step-8-download-wordpress\"><span class=\"ez-toc-section\" id=\"Step_8_Download_WordPress\"><\/span>Step 8: Download WordPress<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Next, we need to download the latest version of WordPress. First, navigate to the web root directory:<\/p>\n<pre><code class=\"lang-bash hljs language-bash\"><span class=\"hljs-built_in\">cd<\/span> \/var\/www\/html<\/code><\/pre>\n<p>Then, download and extract WordPress:<\/p>\n<pre><code class=\"lang-bash hljs language-bash\">wget https:\/\/wordpress.org\/latest.tar.gz  \r\ntar -xvzf latest.tar.gz<\/code><\/pre>\n<p>Now, move the contents into the web root:<\/p>\n<pre><code class=\"lang-bash hljs language-bash\">sudo <span class=\"hljs-built_in\">mv<\/span> wordpress\/* .\/\r\nsudo <span class=\"hljs-built_in\">rm<\/span> -rf wordpress latest.tar.gz<\/code><\/pre>\n<h2 id=\"step-9-configure-wordpress\"><span class=\"ez-toc-section\" id=\"Step_9_Configure_WordPress\"><\/span>Step 9: Configure WordPress<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>WordPress needs to be configured to connect to the database. First, copy the sample configuration file:<\/p>\n<pre><code class=\"lang-bash hljs language-bash\">sudo <span class=\"hljs-built_in\">cp<\/span> wp-config-sample.php wp-config.php<\/code><\/pre>\n<p>Now, edit the\u00a0<code>wp-config.php<\/code>\u00a0file:<\/p>\n<pre><code class=\"lang-bash hljs language-bash\">sudo nano wp-config.php<\/code><\/pre>\n<p>Find the following lines and update them with your database details:<\/p>\n<pre><code class=\"lang-php hljs language-php\"><span class=\"hljs-title function_ invoke__\">define<\/span>(<span class=\"hljs-string\">'DB_NAME'<\/span>, <span class=\"hljs-string\">'wordpress'<\/span>);\r\n<span class=\"hljs-title function_ invoke__\">define<\/span>(<span class=\"hljs-string\">'DB_USER'<\/span>, <span class=\"hljs-string\">'wpuser'<\/span>);\r\n<span class=\"hljs-title function_ invoke__\">define<\/span>(<span class=\"hljs-string\">'DB_PASSWORD'<\/span>, <span class=\"hljs-string\">'password'<\/span>);<\/code><\/pre>\n<p>You can also change the security keys in this file by generating them from the\u00a0<a href=\"https:\/\/api.wordpress.org\/secret-key\/1.1\/salt\/\" target=\"_blank\" rel=\"noopener noreferrer\">WordPress secret key generator<\/a>. Replace the relevant lines in your\u00a0<code>wp-config.php<\/code>.<\/p>\n<h2 id=\"step-10-set-permissions\"><span class=\"ez-toc-section\" id=\"Step_10_Set_Permissions\"><\/span>Step 10: Set Permissions<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>To ensure WordPress can write to the necessary directories, set the correct permissions:<\/p>\n<pre><code class=\"lang-bash hljs language-bash\">sudo <span class=\"hljs-built_in\">chown<\/span> -R www-data:www-data \/var\/www\/html  \r\nsudo find \/var\/www\/html -<span class=\"hljs-built_in\">type<\/span> d -<span class=\"hljs-built_in\">exec<\/span> <span class=\"hljs-built_in\">chmod<\/span> 755 {} \\;\r\nsudo find \/var\/www\/html -<span class=\"hljs-built_in\">type<\/span> f -<span class=\"hljs-built_in\">exec<\/span> <span class=\"hljs-built_in\">chmod<\/span> 644 {} \\;<\/code><\/pre>\n<h2 id=\"step-11-enable-apache-modules\"><span class=\"ez-toc-section\" id=\"Step_11_Enable_Apache_Modules\"><\/span>Step 11: Enable Apache Modules<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>WordPress requires the\u00a0<code>rewrite<\/code>\u00a0module for permalinks to work. Enable this module:<\/p>\n<pre><code class=\"lang-bash hljs language-bash\">sudo a2enmod rewrite  \r\nsudo systemctl restart apache2<\/code><\/pre>\n<p>Next, update the Apache configuration to allow\u00a0<code>.htaccess<\/code>\u00a0overrides. Open the default configuration file:<\/p>\n<pre><code class=\"lang-bash hljs language-bash\">sudo nano \/etc\/apache2\/sites-available\/000-default.conf<\/code><\/pre>\n<p>Find the\u00a0<code>&lt;Directory \/var\/www\/html&gt;<\/code>\u00a0section and change it to:<\/p>\n<pre><code class=\"lang-apache\">&lt;Directory \/var\/www\/html&gt;\r\n    AllowOverride All  \r\n&lt;\/Directory&gt;<\/code><\/pre>\n<p>Save and exit, then restart Apache again:<\/p>\n<pre><code class=\"lang-bash hljs language-bash\">sudo systemctl restart apache2<\/code><\/pre>\n<h2 id=\"step-12-complete-wordpress-installation\"><span class=\"ez-toc-section\" id=\"Step_12_Complete_WordPress_Installation\"><\/span>Step 12: Complete WordPress Installation<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Open your web browser and navigate to\u00a0<code>http:\/\/your_server_ip<\/code>. You should see the WordPress installation page. Follow the on-screen instructions to set up your site, including choosing your site title, username, password, and email.<\/p>\n<h3 id=\"step-13-secure-your-wordpress-site\"><span class=\"ez-toc-section\" id=\"Step_13_Secure_Your_WordPress_Site\"><\/span>Step 13: Secure Your WordPress Site<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>After setting up WordPress, it\u2019s essential to secure your installation:<\/p>\n<ol start=\"1\">\n<li><strong>Keep WordPress Updated<\/strong>: Regularly update WordPress, themes, and plugins to avoid vulnerabilities.<\/li>\n<li><strong>Install a Security Plugin<\/strong>: Consider installing a security plugin like Wordfence or Sucuri for added protection.<\/li>\n<li><strong>Configure a Firewall<\/strong>: On your VPS, you can use UFW (Uncomplicated Firewall) to secure your server. For example, to allow only SSH, HTTP, and HTTPS traffic:\n<pre><code class=\"lang-bash hljs language-bash\">sudo ufw allow OpenSSH  \r\nsudo ufw allow <span class=\"hljs-string\">'Apache Full'<\/span>\r\nsudo ufw <span class=\"hljs-built_in\">enable<\/span><\/code><\/pre>\n<\/li>\n<li><strong>Disable Directory Listing<\/strong>: Edit the Apache configuration file to disable directory listing:\n<pre><code class=\"lang-bash hljs language-bash\">sudo nano \/etc\/apache2\/apache2.conf<\/code><\/pre>\n<p>Add the following line:<\/p>\n<pre><code class=\"lang-apache\">Options -Indexes<\/code><\/pre>\n<p>Then restart Apache:<\/p>\n<pre><code class=\"lang-bash hljs language-bash\">sudo systemctl restart apache2<\/code><\/pre>\n<\/li>\n<li><strong>Regular Backups<\/strong>: Set up a backup plan using plugins or manual backups to ensure you can restore your site if something goes wrong.<\/li>\n<\/ol>\n<h2 id=\"step-14-set-up-a-domain-name-optional\"><span class=\"ez-toc-section\" id=\"Step_14_Set_Up_a_Domain_Name_Optional\"><\/span>Step 14: Set Up a Domain Name (Optional)<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>If you have a domain name, point it to your VPS&#8217;s IP address using your domain registrar\u2019s DNS management tools. After the DNS propagates, you can access your site using the domain name instead of the IP address.<\/p>\n<ol start=\"1\">\n<li><strong>Update your Apache configuration<\/strong>: If you are using a domain name, you may want to create a new configuration file for your site:\n<pre><code class=\"lang-bash hljs language-bash\">sudo nano \/etc\/apache2\/sites-available\/yourdomain.conf<\/code><\/pre>\n<p>Add the following content (replace\u00a0<code>yourdomain.com<\/code>\u00a0with your actual domain):<\/p>\n<pre><code class=\"lang-apache\">&lt;VirtualHost *:80&gt;\r\n    ServerAdmin webmaster@yourdomain.com  \r\n    ServerName yourdomain.com  \r\n    ServerAlias www.yourdomain.com  \r\n    DocumentRoot \/var\/www\/html\r\n\r\n    &lt;Directory \/var\/www\/html&gt;\r\n        Options Indexes FollowSymLinks  \r\n        AllowOverride All  \r\n        Require all granted  \r\n    &lt;\/Directory&gt;\r\n\r\n    ErrorLog ${APACHE_LOG_DIR}\/error.log  \r\n    CustomLog ${APACHE_LOG_DIR}\/access.log combined  \r\n&lt;\/VirtualHost&gt;<\/code><\/pre>\n<\/li>\n<li><strong>Enable the new site and restart Apache<\/strong>:\n<pre><code class=\"lang-bash hljs language-bash\">sudo a2ensite yourdomain.conf  \r\nsudo systemctl restart apache2<\/code><\/pre>\n<\/li>\n<\/ol>\n<h2 id=\"conclusion\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Congratulations! You&#8217;ve successfully set up a WordPress website on your Ubuntu VPS. You&#8217;ve learned how to install the<a href=\"https:\/\/gratisvps.net\/blog\/installing-the-lamp-stack-on-ubuntu-vps\/\"> LAMP stack<\/a>, configure MySQL, download and configure WordPress, and even set up basic security measures.<\/p>\n<h3 id=\"next-steps\"><span class=\"ez-toc-section\" id=\"Next_Steps\"><\/span>Next Steps<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<ul>\n<li><strong>Customize Your Site<\/strong>: Explore the WordPress Dashboard to customize your site\u2019s appearance, install themes, and add plugins.<\/li>\n<li><strong>Content Creation<\/strong>: Start creating posts and pages to populate your website.<\/li>\n<li><strong>SEO Optimization<\/strong>: Consider using SEO plugins like Yoast SEO to optimize your content for search engines.<\/li>\n<\/ul>\n<h3 id=\"additional-resources\"><span class=\"ez-toc-section\" id=\"Additional_Resources\"><\/span>Additional Resources<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<ul>\n<li><a href=\"https:\/\/wordpress.org\/support\/\" target=\"_blank\" rel=\"noopener noreferrer\">Official WordPress Documentation<\/a><\/li>\n<li><a href=\"https:\/\/help.ubuntu.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">Ubuntu Documentation<\/a><\/li>\n<li><a href=\"https:\/\/httpd.apache.org\/docs\/\" target=\"_blank\" rel=\"noopener noreferrer\">Apache Documentation<\/a><\/li>\n<\/ul>\n<p>Feel free to reach out if you have any questions or need further assistance. Happy blogging!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Setting Up a WordPress Website on Ubuntu VPS Introduction In this tutorial, we will walk through the process of setting [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":766,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[215,210,65],"tags":[211,68,67],"class_list":["post-764","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorial","category-ubuntu","category-wordpress","tag-ubuntu","tag-website","tag-wordpress"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.4 (Yoast SEO v27.9) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Setting Up a WordPress Website on Ubuntu VPS<\/title>\n<meta name=\"description\" content=\"In this tutorial, we will walk through the process of setting up a WordPress website on a Virtual Private Server (VPS) using Ubuntu.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/gratisvps.net\/blog\/setting-up-a-wordpress-website-on-ubuntu-vps\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Setting Up a WordPress Website on Ubuntu VPS\" \/>\n<meta property=\"og:description\" content=\"In this tutorial, we will walk through the process of setting up a WordPress website on a Virtual Private Server (VPS) using Ubuntu.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/gratisvps.net\/blog\/setting-up-a-wordpress-website-on-ubuntu-vps\/\" \/>\n<meta property=\"og:site_name\" content=\"Free VPS Hosting Guides\" \/>\n<meta property=\"article:published_time\" content=\"2025-01-11T22:53:23+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/gratisvps.net\/blog\/wp-content\/uploads\/2025\/01\/wordpress-ubuntu.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"832\" \/>\n\t<meta property=\"og:image:height\" content=\"448\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"ariete\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"ariete\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/gratisvps.net\\\/blog\\\/setting-up-a-wordpress-website-on-ubuntu-vps\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/gratisvps.net\\\/blog\\\/setting-up-a-wordpress-website-on-ubuntu-vps\\\/\"},\"author\":{\"name\":\"ariete\",\"@id\":\"https:\\\/\\\/gratisvps.net\\\/blog\\\/#\\\/schema\\\/person\\\/cddcf8cb5192d0713c19b79425c77fc4\"},\"headline\":\"Setting Up a WordPress Website on Ubuntu VPS\",\"datePublished\":\"2025-01-11T22:53:23+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/gratisvps.net\\\/blog\\\/setting-up-a-wordpress-website-on-ubuntu-vps\\\/\"},\"wordCount\":817,\"publisher\":{\"@id\":\"https:\\\/\\\/gratisvps.net\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/gratisvps.net\\\/blog\\\/setting-up-a-wordpress-website-on-ubuntu-vps\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/gratisvps.net\\\/blog\\\/wp-content\\\/uploads\\\/2025\\\/01\\\/wordpress-ubuntu.jpg\",\"keywords\":[\"Ubuntu\",\"website\",\"wordpress\"],\"articleSection\":[\"Tutorial\",\"Ubuntu\",\"WordPress\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/gratisvps.net\\\/blog\\\/setting-up-a-wordpress-website-on-ubuntu-vps\\\/\",\"url\":\"https:\\\/\\\/gratisvps.net\\\/blog\\\/setting-up-a-wordpress-website-on-ubuntu-vps\\\/\",\"name\":\"Setting Up a WordPress Website on Ubuntu VPS\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/gratisvps.net\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/gratisvps.net\\\/blog\\\/setting-up-a-wordpress-website-on-ubuntu-vps\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/gratisvps.net\\\/blog\\\/setting-up-a-wordpress-website-on-ubuntu-vps\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/gratisvps.net\\\/blog\\\/wp-content\\\/uploads\\\/2025\\\/01\\\/wordpress-ubuntu.jpg\",\"datePublished\":\"2025-01-11T22:53:23+00:00\",\"description\":\"In this tutorial, we will walk through the process of setting up a WordPress website on a Virtual Private Server (VPS) using Ubuntu.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/gratisvps.net\\\/blog\\\/setting-up-a-wordpress-website-on-ubuntu-vps\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/gratisvps.net\\\/blog\\\/setting-up-a-wordpress-website-on-ubuntu-vps\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/gratisvps.net\\\/blog\\\/setting-up-a-wordpress-website-on-ubuntu-vps\\\/#primaryimage\",\"url\":\"https:\\\/\\\/gratisvps.net\\\/blog\\\/wp-content\\\/uploads\\\/2025\\\/01\\\/wordpress-ubuntu.jpg\",\"contentUrl\":\"https:\\\/\\\/gratisvps.net\\\/blog\\\/wp-content\\\/uploads\\\/2025\\\/01\\\/wordpress-ubuntu.jpg\",\"width\":832,\"height\":448,\"caption\":\"wordpress-ubuntu\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/gratisvps.net\\\/blog\\\/setting-up-a-wordpress-website-on-ubuntu-vps\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/gratisvps.net\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Setting Up a WordPress Website on Ubuntu VPS\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/gratisvps.net\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/gratisvps.net\\\/blog\\\/\",\"name\":\"Gratisvps.net | Blog Daily Tech Info\",\"description\":\"GratisVPS.NET\",\"publisher\":{\"@id\":\"https:\\\/\\\/gratisvps.net\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/gratisvps.net\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/gratisvps.net\\\/blog\\\/#organization\",\"name\":\"Gratisvps.net | Blog Daily Tech Info\",\"url\":\"https:\\\/\\\/gratisvps.net\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/gratisvps.net\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/gratisvps.net\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/10\\\/logo.png\",\"contentUrl\":\"https:\\\/\\\/gratisvps.net\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/10\\\/logo.png\",\"width\":250,\"height\":67,\"caption\":\"Gratisvps.net | Blog Daily Tech Info\"},\"image\":{\"@id\":\"https:\\\/\\\/gratisvps.net\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/gratisvps.net\\\/blog\\\/#\\\/schema\\\/person\\\/cddcf8cb5192d0713c19b79425c77fc4\",\"name\":\"ariete\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b93881052caa63fd6b2fb5468a80afcf9f985a165c6d4de11a72cc4c0775f74a?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b93881052caa63fd6b2fb5468a80afcf9f985a165c6d4de11a72cc4c0775f74a?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b93881052caa63fd6b2fb5468a80afcf9f985a165c6d4de11a72cc4c0775f74a?s=96&d=mm&r=g\",\"caption\":\"ariete\"},\"sameAs\":[\"https:\\\/\\\/gratisvps.net\\\/blog\"],\"url\":\"https:\\\/\\\/gratisvps.net\\\/blog\\\/author\\\/ariete\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Setting Up a WordPress Website on Ubuntu VPS","description":"In this tutorial, we will walk through the process of setting up a WordPress website on a Virtual Private Server (VPS) using Ubuntu.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/gratisvps.net\/blog\/setting-up-a-wordpress-website-on-ubuntu-vps\/","og_locale":"en_US","og_type":"article","og_title":"Setting Up a WordPress Website on Ubuntu VPS","og_description":"In this tutorial, we will walk through the process of setting up a WordPress website on a Virtual Private Server (VPS) using Ubuntu.","og_url":"https:\/\/gratisvps.net\/blog\/setting-up-a-wordpress-website-on-ubuntu-vps\/","og_site_name":"Free VPS Hosting Guides","article_published_time":"2025-01-11T22:53:23+00:00","og_image":[{"width":832,"height":448,"url":"https:\/\/gratisvps.net\/blog\/wp-content\/uploads\/2025\/01\/wordpress-ubuntu.jpg","type":"image\/jpeg"}],"author":"ariete","twitter_card":"summary_large_image","twitter_misc":{"Written by":"ariete","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/gratisvps.net\/blog\/setting-up-a-wordpress-website-on-ubuntu-vps\/#article","isPartOf":{"@id":"https:\/\/gratisvps.net\/blog\/setting-up-a-wordpress-website-on-ubuntu-vps\/"},"author":{"name":"ariete","@id":"https:\/\/gratisvps.net\/blog\/#\/schema\/person\/cddcf8cb5192d0713c19b79425c77fc4"},"headline":"Setting Up a WordPress Website on Ubuntu VPS","datePublished":"2025-01-11T22:53:23+00:00","mainEntityOfPage":{"@id":"https:\/\/gratisvps.net\/blog\/setting-up-a-wordpress-website-on-ubuntu-vps\/"},"wordCount":817,"publisher":{"@id":"https:\/\/gratisvps.net\/blog\/#organization"},"image":{"@id":"https:\/\/gratisvps.net\/blog\/setting-up-a-wordpress-website-on-ubuntu-vps\/#primaryimage"},"thumbnailUrl":"https:\/\/gratisvps.net\/blog\/wp-content\/uploads\/2025\/01\/wordpress-ubuntu.jpg","keywords":["Ubuntu","website","wordpress"],"articleSection":["Tutorial","Ubuntu","WordPress"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/gratisvps.net\/blog\/setting-up-a-wordpress-website-on-ubuntu-vps\/","url":"https:\/\/gratisvps.net\/blog\/setting-up-a-wordpress-website-on-ubuntu-vps\/","name":"Setting Up a WordPress Website on Ubuntu VPS","isPartOf":{"@id":"https:\/\/gratisvps.net\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/gratisvps.net\/blog\/setting-up-a-wordpress-website-on-ubuntu-vps\/#primaryimage"},"image":{"@id":"https:\/\/gratisvps.net\/blog\/setting-up-a-wordpress-website-on-ubuntu-vps\/#primaryimage"},"thumbnailUrl":"https:\/\/gratisvps.net\/blog\/wp-content\/uploads\/2025\/01\/wordpress-ubuntu.jpg","datePublished":"2025-01-11T22:53:23+00:00","description":"In this tutorial, we will walk through the process of setting up a WordPress website on a Virtual Private Server (VPS) using Ubuntu.","breadcrumb":{"@id":"https:\/\/gratisvps.net\/blog\/setting-up-a-wordpress-website-on-ubuntu-vps\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/gratisvps.net\/blog\/setting-up-a-wordpress-website-on-ubuntu-vps\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/gratisvps.net\/blog\/setting-up-a-wordpress-website-on-ubuntu-vps\/#primaryimage","url":"https:\/\/gratisvps.net\/blog\/wp-content\/uploads\/2025\/01\/wordpress-ubuntu.jpg","contentUrl":"https:\/\/gratisvps.net\/blog\/wp-content\/uploads\/2025\/01\/wordpress-ubuntu.jpg","width":832,"height":448,"caption":"wordpress-ubuntu"},{"@type":"BreadcrumbList","@id":"https:\/\/gratisvps.net\/blog\/setting-up-a-wordpress-website-on-ubuntu-vps\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/gratisvps.net\/blog\/"},{"@type":"ListItem","position":2,"name":"Setting Up a WordPress Website on Ubuntu VPS"}]},{"@type":"WebSite","@id":"https:\/\/gratisvps.net\/blog\/#website","url":"https:\/\/gratisvps.net\/blog\/","name":"Gratisvps.net | Blog Daily Tech Info","description":"GratisVPS.NET","publisher":{"@id":"https:\/\/gratisvps.net\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/gratisvps.net\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/gratisvps.net\/blog\/#organization","name":"Gratisvps.net | Blog Daily Tech Info","url":"https:\/\/gratisvps.net\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/gratisvps.net\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/gratisvps.net\/blog\/wp-content\/uploads\/2024\/10\/logo.png","contentUrl":"https:\/\/gratisvps.net\/blog\/wp-content\/uploads\/2024\/10\/logo.png","width":250,"height":67,"caption":"Gratisvps.net | Blog Daily Tech Info"},"image":{"@id":"https:\/\/gratisvps.net\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/gratisvps.net\/blog\/#\/schema\/person\/cddcf8cb5192d0713c19b79425c77fc4","name":"ariete","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/b93881052caa63fd6b2fb5468a80afcf9f985a165c6d4de11a72cc4c0775f74a?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/b93881052caa63fd6b2fb5468a80afcf9f985a165c6d4de11a72cc4c0775f74a?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/b93881052caa63fd6b2fb5468a80afcf9f985a165c6d4de11a72cc4c0775f74a?s=96&d=mm&r=g","caption":"ariete"},"sameAs":["https:\/\/gratisvps.net\/blog"],"url":"https:\/\/gratisvps.net\/blog\/author\/ariete\/"}]}},"_links":{"self":[{"href":"https:\/\/gratisvps.net\/blog\/wp-json\/wp\/v2\/posts\/764","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gratisvps.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gratisvps.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gratisvps.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gratisvps.net\/blog\/wp-json\/wp\/v2\/comments?post=764"}],"version-history":[{"count":2,"href":"https:\/\/gratisvps.net\/blog\/wp-json\/wp\/v2\/posts\/764\/revisions"}],"predecessor-version":[{"id":767,"href":"https:\/\/gratisvps.net\/blog\/wp-json\/wp\/v2\/posts\/764\/revisions\/767"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gratisvps.net\/blog\/wp-json\/wp\/v2\/media\/766"}],"wp:attachment":[{"href":"https:\/\/gratisvps.net\/blog\/wp-json\/wp\/v2\/media?parent=764"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gratisvps.net\/blog\/wp-json\/wp\/v2\/categories?post=764"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gratisvps.net\/blog\/wp-json\/wp\/v2\/tags?post=764"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}