A VDS (Virtual Dedicated Server) is a virtual dedicated server that provides users with a fully isolated space for hosting a website or application. It is a more powerful and flexible solution than regular hosting. On a VDS, you can control the server and install any software. How do you deploy a website on a VDS? To do this, you need to complete several basic configurations.
Before installing a website, you need to prepare your server. Here’s what you need to do:
ssh root@IP_address_of_your_server
apt update && apt upgrade -y
adduser your_username
usermod -aG sudo your_username
ufw allow OpenSSH
ufw enable
Now, your server is ready for further work.
To function on the website, you must install the LAMP stack (“Linux, Apache, MySQL, PHP”), which is ideal for most projects. The commands listed below should also be entered using the terminal.
Apache is a web server that processes user requests and delivers website pages. It is widely used due to its reliability and flexibility.
sudo apt install apache2
After installation, enter your server's IP address in a browser. If the installation was successful, you will see the default Apache page.
MySQL is a database management system that stores all vital website information, such as user accounts, page content, and other data.
sudo apt install mysql-server
sudo mysql_secure_installation
This command will install MySQL and configure its security. After running it, you will be prompted to set a password for the database administrator (root). Enter a strong password. If the password prompt does not appear automatically, run the command sudo mysql_secure_installation and follow the system instructions.
PHP is a programming language that allows your website to perform dynamic functions, such as processing forms or interacting with the database. It integrates with Apache and MySQL, creating a powerful tool for web applications.
sudo apt install php libapache2-mod-php php-mysql
To verify that PHP is working, create a test file info.php in the /var/www/html directory:
echo "" > /var/www/html/info.php
Open http://IP_address/info.php in a browser to confirm that PHP is configured correctly.
After preparing the server, the next step is to install your website. This process includes uploading website files, setting up the database, and configuring the web server.
Your website files should be uploaded to the server in the web server directory, usually /var/www/html. To transfer files, you can use SCP (Secure Copy Protocol) or SFTP (for example, via FileZilla).
For SCP, execute the command:
scp -r /path_to_local_files username@IP_address:/var/www/html/
For SFTP, open FileZilla, connect to the server using the IP address, login, and password, and then drag the website files into the appropriate directory.
Create a database in MySQL if your website uses a database (e.g., WordPress, Joomla). Follow these steps:
mysql -u root -p
CREATE DATABASE database_name;
GRANT ALL ON database_name.* TO 'username'@'localhost' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
EXIT;
Write down the database name, username, and password. These credentials will be needed for website configuration.
To ensure the website functions correctly, create a new virtual host:
sudo nano /etc/apache2/sites-available/your_website.conf
ServerName your_domain
DocumentRoot /var/www/html/your_website
AllowOverride All
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
sudo a2ensite your_website
sudo systemctl restart apache2
If errors occur, check Apache logs:
tail -f /var/log/apache2/error.log
Important: Ensure your domain points to the server’s IP address (A-record in DNS). Otherwise, the website may not be accessible.
If your website (e.g., CMS WordPress, OpenCart, or any other engine) uses a database, follow these steps:
As a result, you will receive:
These details must be specified in your website's configuration (in the wp-config.php file for WordPress, config.php for other CMSs, etc.).
To make your website accessible via HTTPS, install an SSL certificate. ISPmanager provides convenient tools for this.
Learn more about how to purchase a domain, hosting, VPS, or dedicated server.
A VDS should be used when more flexibility in configuring the server environment is required than shared hosting can offer. For example, it is suitable for hosting resource-intensive projects, demanding applications, or databases where stability and scalability are crucial.
VDS (Virtual Dedicated Server) and VPS (Virtual Private Server) are often used interchangeably. Both refer to a virtual machine on a physical server. However, in some cases, VDS may imply a higher isolation level.
The choice of configuration depends on your project's specific needs. Consider parameters such as the number of CPU cores, RAM size, and SSD storage capacity.