fbpx

How to Host a Website on a Linux VPS in Malaysia

  • Home
  • General
  • How to Host a Website on a Linux VPS in Malaysia
How to Host a Website on a Linux VPS in Malaysia

Hosting your website on a Linux VPS is a powerful way to gain full control over your web environment, optimize performance, and ensure data privacy. Whether you’re a web development beginner or a small business owner in Malaysia, this guide walks you through every step of deploying your website using a Linux VPS. With VPS Malaysia, the process becomes even smoother. In this in-depth guide, we cover everything from selecting your Linux distribution to securing your site with SSL and launching it live.

1. Prerequisites & Server Preparation

A. Choosing the Right Linux Distribution

Before you begin, you’ll need to choose a Linux distribution. The most beginner-friendly options are Ubuntu, CentOS, and Debian. Each has its advantages:

  • Ubuntu: Great for beginners, large community, frequent updates.
  • CentOS: Stable and secure, preferred for enterprise environments.
  • Debian: Very stable and perfect for custom builds.

Here’s a quick comparison:

FeatureUbuntuCentOSDebian
PopularityVery highModerateHigh
Community SupportExtensiveStrongStrong
Release CycleFrequentStableVery stable
Ease of UseBeginner-friendlyModerateModerate
Comparison of Ubuntu, CentOS, and Debian

Tip: VPS Malaysia offers pre-configured images of all major distributions to save setup time.

B. Access via SSH

Once your VPS is ready, log in using SSH:

ssh root@your_server_ip

You can also set up SSH key-based authentication for added security:

ssh-keygen -t rsa -b 4096
ssh-copy-id root@your_server_ip

2. Setting Up LAMP Stack (Apache, MySQL, PHP)

The LAMP stack is the foundation of most Linux-hosted websites:

  • Linux: Your VPS operating system.
  • Apache: The web server software.
  • MySQL: The database engine.
  • PHP: The server-side scripting language.

A. Installing Apache & Testing

Install Apache:

sudo apt update

sudo apt install apache2

Enable the service:

sudo systemctl start apache2

sudo systemctl enable apache2

Test it by visiting “http://your_server_ip” — you should see the Apache default page.

B. Securing MySQL (Create Database, User)

Install MySQL:

sudo apt install mysql-server

Secure the installation:

sudo mysql_secure_installation

Create a database and a user:

CREATE DATABASE mydb;
CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'securepassword';
GRANT ALL PRIVILEGES ON mydb.* TO 'myuser'@'localhost';
FLUSH PRIVILEGES;

This setup ensures that your database is ready for any CMS or custom PHP application.

C. Configuring PHP & Testing phpinfo()

Install PHP and modules:

sudo apt install php libapache2-mod-php php-mysql

Create a test file:

echo "<?php phpinfo(); ?>" > /var/www/html/info.php

Visit “http://your_server_ip/info.php” to verify PHP functionality.

VPS Malaysia offers optional LAMP stack installation to simplify this step for beginners.

3. Configuring a Domain & Virtual Host

A. Pointing Domain DNS Records

To connect your domain name with your VPS:

  • Log in to your domain registrar.
  • Set the A Record to point to your VPS IP address.
  • TTL should be set to 300 or the default.

DNS propagation can take up to 24–48 hours globally, but often updates in a few hours in Malaysia.

B. Creating /etc/apache2/sites-available/yourdomain.conf

Create the necessary folders:

sudo mkdir -p /var/www/yourdomain

Sample virtual host config:

<VirtualHost *:80>
    ServerAdmin adminyourdomain.com
    ServerName yourdomain.com
    DocumentRoot /var/www/yourdomain
    <Directory /var/www/yourdomain>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Enable it:

a2ensite yourdomain.conf

systemctl reload apache2

C. Enabling SSL With Let’s Encrypt

Install Certbot:

sudo apt install certbot python3-certbot-apache

Run Certbot:

sudo certbot --apache -d yourdomain.com

Set up auto-renew:

sudo crontab -e

0 0 * * * /usr/bin/certbot renew --quiet

4. Uploading Your Website Files

A. Using FTP/SFTP

SFTP is secure and preferred over FTP:

  • Use FileZilla or WinSCP.
  • Protocol: SFTP.
  • Host: yourdomain.com.
  • Port: 22.
  • Username: root or created user.

To create a user for uploads:

sudo adduser uploader

sudo usermod -aG www-data uploader

B. Permissions and Ownership Settings

chown -R www-data:www-data /var/www/yourdomain

chmod -R 755 /var/www/yourdomain

Avoid giving write access to all users. Proper permissions improve security and performance.

5. Testing & Go‑Live

A. Checking Web Server Logs

Useful Apache logs:

tail -f /var/log/apache2/access.log

tail -f /var/log/apache2/error.log

Check for common issues:

  • 403: Permission issue.
  • 404: Missing file or misconfigured virtual host.
  • 500: PHP error or misconfigured file.

B. Final Performance Tweaks

  • Enable caching modules:
a2enmod cache

sudo a2enmod expires

sudo systemctl restart apache2
  • Minify CSS/JS files.
  • Use a CDN for static resources.
  • Enable Gzip compression via .htaccess.

VPS Malaysia’s SSD RAID 10 and DDoS protection ensure optimal speed and uptime.

Want to skip the hassle? Explore our Managed Linux VPS Plans →

6. Shared Hosting vs. Linux VPS: Why Upgrade?

FeatureShared HostingLinux VPS (VPS Malaysia)
PerformanceShared resourcesDedicated resources
Root Access
Custom ConfigLimitedFull control
PriceLowScalable mid-range
SecurityBasicAdvanced
ScalabilityLimitedHigh
Shared Hosting vs. Linux VPS

Fact: Linux powers over 75% of the world’s web servers. VPS-hosted sites can load up to 300% faster than shared hosting.

7. Ready to Host a Website on a Linux VPS With Ease?

Linux VPS Hosting
Linux VPS Hosting

Launching your website doesn’t have to be complex. With VPS Malaysia, you get:

  • Pre-configured Linux VPS environments.
  • Full root access & SSD storage.
  • Free SSL certificates.
  • 24/7 local support in Malaysia.
  • Optional LAMP stack setup.

Whether you’re hosting a business site, blog, or custom web app, Linux VPS gives you unmatched control and flexibility. And with VPS Malaysia’s infrastructure and local support, you’re never alone in the process.

Still unsure? Get a free consultation or sign up for a trial to see how effortless Linux VPS hosting can be with VPS Malaysia. Our team is here to help you every step of the way.

Leave a Reply