05/09/2023
read 5 minutes

Deploying a website on a 3HCloud server using LAMP and Wordpress

/upload/iblock/1c6/5y7x3444aqae1r4oeyfxx1z1lk9jxtdz/souvik-banerjee--WPrNEM_6dg-unsplash.jpg

In this article, we will discuss the process of deploying a LAMP stack, installing WordPress, and launching your site on the 3HCloud cloud server. The purpose of this guide is to provide clear and concise steps to help you establish a reliable and efficient online presence. Let’s get started!

A brief overview

The LAMP stack is an acronym for Linux, Apache, MySQL, and PHP, representing a widely-used combination of open-source software that powers a significant portion of the web. Linux serves as the operating system, Apache as the web server, MySQL as the database management system, and PHP as the server-side scripting language. These components work in unison to provide a robust foundation for web applications.

WordPress is a popular content management system (CMS) that allows users to create, manage, and publish content on the web with ease. It offers extensive customization through themes and plugins, making it a versatile choice for websites of various types and sizes.

3HCloud is a cloud server provider that offers scalable and reliable hosting solutions. By launching your site on the 3HCloud cloud server, you can leverage its flexibility, cost-effectiveness, and high-performance infrastructure to accommodate the needs of your growing website.

Together, these technologies create a powerful synergy that allows you to build and deploy a functional, dynamic, and secure website with ease.

Step 1: Create a 3HCloud account and server, and connect via SSH

Dependable Cloud Servers
arrow
arrow hover

Sign up for a 3HCloud account and create a new cloud server. Choose an appropriate server size, location, and Linux distribution. Once your server is up and running, connect to it via SSH using an SSH client like PuTTY on Windows or the built-in terminal on macOS and Linux:

ssh root@your_server_ip

Next, update your server's package list and upgrade existing packages:

sudo apt-get update
sudo apt-get upgrade

Step 2: Install the LAMP stack

Install the LAMP stack components:

sudo apt-get install apache2
sudo apt-get install mysql-server
sudo apt-get install php libapache2-mod-php php-mysql

Step 3: Secure MySQL installation and create a database for WordPress

Run the MySQL security script and follow the prompts:

sudo mysql_secure_installation

Log in to MySQL, create a new database, and user for WordPress:

sudo mysql -u root -p

CREATE DATABASE wordpress_db;
CREATE USER 'wordpress_user'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON wordpress_db.* TO 'wordpress_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Step 4: Download and configure WordPress

Download the latest WordPress package, extract it, and move it to the Apache web directory:

wget https://wordpress.org/latest.tar.gz
tar xf latest.tar.gz
sudo mv wordpress /var/www/html/wordpress

Copy the sample configuration file and update the database connection details:

cd /var/www/html/wordpress
sudo cp wp-config-sample.php wp-config.php
sudo nano wp-config.php

Update the following lines with your database information:

define('DB_NAME', 'wordpress_db');
define('DB_USER', 'wordpress_user');
define('DB_PASSWORD', 'your_password');
define('DB_HOST', 'localhost');

Step 5: Set permissions and configure Apache

Set the correct ownership and permissions for the WordPress directory:

sudo chown -R www-data:www-data /var/www/html/wordpress
sudo find /var/www/html/wordpress -type d -exec chmod 750 {} \;
sudo find /var/www/html/wordpress -type f -exec chmod 640 {} \;

Create a new Apache configuration file for your WordPress site and enable the site:

sudo nano /etc/apache2/sites-available/wordpress.conf

Add the following content, replacing your email and domain:

<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot /var/www/html/wordpress
    ServerName your_domain.com
    ServerAlias www.your_domain.com
    <Directory /var/www/html/wordpress/>
        AllowOverride All
    </Directory>
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Enable the configuration and restart Apache:

sudo a2ensite wordpress
sudo a2enmod rewrite
sudo systemctl restart apache2

Step 6: Point domain to 3HCloud server and complete the WordPress installation

Update your domain's DNS settings to point to your 3HCloud server's IP address. Once the DNS changes have propagated, visit your domain http://your_domain.com) in a web browser to complete the WordPress installation.

Follow the on-screen instructions to create an administrator account and log in to your WordPress dashboard.

In conclusion

Congratulations! You have successfully deployed a LAMP stack, installed WordPress, and launched your site on the 3HCloud cloud server. You can now customize your WordPress site, install themes and plugins, and begin creating content. We hope that this guide has been helpful to you in your web development journey.

News
28 March 202403/28/2024
read 1 minuteread 1 min
3HCloud Brings GPU Servers to Miami
28 December 202312/28/2023
read 2 minutesread 2 min
New features and tariffs