Shubham S Nimje logo
Shubham Nimje
VPS Hosting

Setting Up WordPress on Hostinger VPS Hosting

Setting Up WordPress on Hostinger VPS Hosting
2 min read
#VPS Hosting

Step 1: Secure MySQL Installation

Before setting up WordPress, it’s essential to secure your MySQL installation. Execute the following command in your terminal:

sudo mysql_secure_installation

Follow the prompts to set a root password, remove anonymous users, disallow root login remotely, remove the test database, and reload privileges.

Step 2: Create WordPress Database and User

Log in to MySQL as the root user:

sudo mysql -u root -p

Enter your MySQL root password when prompted. Then, create a new database for WordPress and a user with appropriate privileges:

CREATE DATABASE wordpress;
CREATE USER 'wordpressuser'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpressuser'@'localhost';
FLUSH PRIVILEGES;

Step 3: Download and Extract WordPress

Navigate to the HTML directory:

cd /var/www/html

Download the latest WordPress package using wget:

sudo wget https://wordpress.org/latest.tar.gz

Extract the downloaded file:

sudo tar -xzvf latest.tar.gz

Step 4: Set Permissions

Ensure the correct permissions are set for the WordPress directory:

sudo chown -R www-data:www-data /var/www/html
sudo chmod -R 755 /var/www/html

Step 5: Rename wp-config Sample File

Rename the wp-config-sample.php file to wp-config.php:

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

Step 6: Configure wp-config.php

Edit the wp-config.php file using a text editor and update the database details:

sudo nano wp-config.php

Replace the database name, username, and password placeholders with the details you created earlier:

define( 'DB_NAME', 'wordpress' );
define( 'DB_USER', 'wordpressuser' );
define( 'DB_PASSWORD', 'your_password' );
define( 'DB_HOST', 'localhost' );

Step 7: Enable Apache Rewrite Module

Enable the Apache rewrite module to allow WordPress permalinks to function correctly:

sudo a2enmod rewrite

Step 8: Restart Apache

Restart the Apache web server to apply the changes:

sudo systemctl restart apache2

Conclusion

Congratulations! You’ve successfully set up WordPress on Hostinger VPS hosting. By following these steps, you’ve created a solid foundation for building and managing your WordPress website. Now, you can proceed to access your WordPress site via the browser and complete the installation and configuration process through the WordPress setup wizard. Enjoy building your website with Hostinger’s reliable VPS hosting services!