Category: Server Management

Learn how to manage your VPS or dedicated server like a pro. From Linux commands to configuring NGINX, firewalls, and SSH, this category is for developers, sysadmins, and serious users who want full control.

  • Installing and Configuring Apache on Ubuntu

    Installing and Configuring Apache on Ubuntu

    Installing and Configuring Apache on Ubuntu: A Step-by-Step Guide

    If you’re hosting your own website or application, installing and configuring a web server is a crucial step. One of the most popular and powerful web servers available today is Apache HTTP Server — often just called Apache.

    In this guide, we’ll walk you through how to install and configure Apache on Ubuntu, from setting it up to hosting your first site, securing it, and fine-tuning performance.

    Whether you’re using a VPS from Vicservers or a local Ubuntu server, this tutorial will give you a production-ready setup.


     What Is Apache?

    Apache is an open-source web server developed by the Apache Software Foundation. It powers over 30% of all websites globally and supports a wide range of functionalities, from simple HTML serving to complex PHP and database-backed apps.

    Key Benefits:

    • Cross-platform and highly configurable
    • Modules for SSL, security, logging, caching, and more
    • Excellent community support
    • Stable, secure, and scalable

     Prerequisites

    Before starting, make sure you have:

    ✅ An Ubuntu-based server (20.04, 22.04, or later)
    ✅ Root or sudo access
    ✅ A terminal or SSH access to your server

    If you’re using Vicservers, your VPS is ready with SSH access and Ubuntu pre-installed.


    1.  Connect to Your Server

    Open your terminal and connect via SSH:

    ssh username@your_server_ip
    

    Replace username with your server’s user (e.g., root or ubuntu) and your_server_ip with your VPS IP.


    2.  Update the System

    It’s always a good idea to update your package list and system before installing new software:

    sudo apt update
    sudo apt upgrade -y
    

    3.  Install Apache

    Now, install Apache using Ubuntu’s built-in package manager:

    sudo apt install apache2 -y
    

    Once installed, Apache will start automatically. To check its status:

    sudo systemctl status apache2
    

    You should see something like:

    active (running)
    

    4.  Test Apache

    Open a web browser and visit your server’s IP:

    http://your_server_ip
    

    You should see Apache’s default “It works!” page. That confirms Apache is successfully installed and serving content.


    5. Configure the UFW Firewall

    If you’re using UFW (Uncomplicated Firewall), you need to allow Apache traffic:

    sudo ufw allow 'Apache Full'
    

    Then enable UFW (if not already done):

    sudo ufw enable
    sudo ufw status
    

    You should see ports 80 (HTTP) and 443 (HTTPS) open.


    6.  Understand Apache Directory Structure

    Apache’s configuration on Ubuntu is located in /etc/apache2. Key directories:

    • /etc/apache2/apache2.conf: Main config file
    • /etc/apache2/sites-available/: Virtual host files
    • /etc/apache2/sites-enabled/: Active sites
    • /var/www/html/: Default document root
    • /etc/apache2/mods-enabled/: Active modules

    Apache uses modules and virtual hosts to provide flexible configurations.


    7.  Host a Website Using Apache

    Let’s host a simple HTML site under a custom domain like example.com.

    Step 1: Create a directory for your site

    sudo mkdir -p /var/www/example.com/html
    

    Give it proper permissions:

    sudo chown -R $USER:$USER /var/www/example.com/html
    

    Step 2: Add a sample webpage

    nano /var/www/example.com/html/index.html
    

    Paste in:

    <html>
      <head><title>Welcome to Example.com!</title></head>
      <body><h1>Success! Apache is working on your domain.</h1></body>
    </html>
    

    Save and exit (Ctrl + O, then Ctrl + X).

    Step 3: Create a Virtual Host file

    sudo nano /etc/apache2/sites-available/example.com.conf
    

    Paste the following:

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

    Step 4: Enable the site and reload Apache

    sudo a2ensite example.com.conf
    sudo systemctl reload apache2
    

    Now, if your domain is pointed to your server’s IP, visiting http://example.com should show your custom page.


    8.  Enable Rewrite Module (For Pretty URLs)

    Many apps like WordPress require Apache’s mod_rewrite for SEO-friendly URLs.

    Enable it with:

    sudo a2enmod rewrite
    sudo systemctl restart apache2
    

    To allow rewrites in .htaccess files, modify your site config:

    sudo nano /etc/apache2/sites-available/example.com.conf
    

    Inside the <VirtualHost> block, add:

    <Directory /var/www/example.com/html>
        AllowOverride All
    </Directory>
    

    Then reload Apache again:

    sudo systemctl reload apache2
    

    9.  Secure Your Site with HTTPS (SSL)

    Use Let’s Encrypt and Certbot to add a free SSL certificate.

    Step 1: Install Certbot

    sudo apt install certbot python3-certbot-apache -y
    

    Step 2: Run Certbot

    sudo certbot --apache
    

    Follow the prompts to:

    • Choose your domain
    • Automatically redirect HTTP to HTTPS

    Certbot will install the certificate, update Apache configs, and reload the server.

    To test renewal:

    sudo certbot renew --dry-run
    

    10.  Monitor Apache Logs

    Logs help you debug problems:

    • Access log: /var/log/apache2/access.log
    • Error log: /var/log/apache2/error.log

    To view them:

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

    Or:

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

    11.  Performance Tuning (Optional)

    Some useful Apache modules and tweaks:

    • mod_deflate: Enables gzip compression
      Enable with:

      sudo a2enmod deflate && sudo systemctl restart apache2
      
    • mod_headers: For caching and security headers
      sudo a2enmod headers
      
    • Adjust MaxRequestWorkers and KeepAlive in /etc/apache2/apache2.conf for high traffic optimization.

    12.  Uninstall Apache (If Needed)

    To remove Apache:

    sudo apt remove apache2
    sudo apt autoremove
    

    This will uninstall Apache but not delete your site data or logs.


    🏁 Conclusion: Apache + Ubuntu = Power, Flexibility, Control

    Setting up Apache on Ubuntu is a foundational step in taking full control of your website or application. Whether you’re building a static site, deploying a PHP app, or running WordPress, Apache offers the stability and configurability needed for serious web hosting.


     Why Use Vicservers for Your Apache Hosting?

    Vicservers offers optimized Linux-based VPS and cloud hosting with:

    ✅ 1-click Ubuntu installation
    ✅ Full root access
    ✅ Pre-configured Apache templates (optional)
    ✅ Free SSL certificates
    ✅ 24/7 support from real humans
    ✅ Affordable pricing with guaranteed uptime

    Apache performs best on reliable infrastructure. Vicservers gives you the speed, support, and security you need to launch with confidence.


     Ready to Deploy?

    Start hosting your site on a rock-solid Apache server today.

    Get started at Vicservers.com

    We’ll handle the infrastructure — you focus on building.

     

  • How to Set Up a VPS from Scratch (Linux-Based)

    How to Set Up a VPS from Scratch (Linux-Based)

    How to Set Up a VPS from Scratch (Linux-Based)

     

    So you’ve just purchased your Linux-based VPS (Virtual Private Server) from Vicservers congratulations! You now have more control, better performance, and greater flexibility than shared hosting can offer.

    But what do you do next?

    If you’re new to VPS hosting, the setup process may seem a little intimidating. Fear not—this comprehensive step-by-step guide will walk you through setting up your Linux VPS from scratch, covering everything from logging in via SSH to securing your server and hosting a basic website.

    What You’ll Learn:

    • What a VPS is and why Linux is a solid choice
    • Connecting to your VPS via SSH
    • Updating your system
    • Creating a new user and hardening root access
    • Setting up a firewall
    • Installing essential software (Nginx, Apache, MySQL, etc.)
    • Hosting a website on your VPS
    • Backups, monitoring, and future steps

    Let’s get started.

    1.  What Is a VPS (and Why Use Linux)?

    A Virtual Private Server (VPS) is a virtualized machine running its own copy of an OS—often Linux. You get full control of your environment: install software, configure settings, host websites or apps, and manage resources.

    Why Linux?

    • It’s open source, lightweight, and extremely secure
    • Popular Linux distributions like Ubuntu, Debian, and CentOS are supported by most applications
    • You can automate nearly everything from the command line

    At Vicservers, all our VPS plans offer full root access and the ability to choose your preferred Linux distro.

    2.  Connecting to Your VPS via SSH

    Prerequisites:

    • IP address of your VPS (sent in your welcome email)
    • SSH client (Terminal for macOS/Linux, PuTTY for Windows)
    • Login credentials (usually root)

    SSH Command:

    ssh root@your_vps_ip
    

    On first connection, you may see a warning about authenticity—type yes to proceed.

     Tip: Always change your root password after your first login using passwd.


    3. Update and Upgrade the System

    Before installing anything, make sure your VPS is up to date.

    For Ubuntu/Debian:

    apt update && apt upgrade -y
    

    For CentOS/RHEL:

    yum update -y
    

    Keeping your packages updated is critical for security and stability.


    4.  Create a New User and Disable Root Login

    Using the root account for everything is risky. Instead, create a new user with sudo privileges.

    Create a new user:

    adduser yourusername
    

    Grant sudo access:

    usermod -aG sudo yourusername
    

    Now, test it:

    su - yourusername
    sudo ls
    

    Disable root login (optional but highly recommended):

    Edit the SSH config file:

    sudo nano /etc/ssh/sshd_config
    

    Find:

    PermitRootLogin yes
    

    Change to:

    PermitRootLogin no
    

    Then restart SSH:

    sudo systemctl restart ssh
    

    5. Set Up a Basic Firewall (UFW)

    A firewall controls which traffic is allowed. UFW (Uncomplicated Firewall) is perfect for beginners.

    Enable UFW:

    sudo ufw allow OpenSSH
    sudo ufw enable
    sudo ufw status
    

    For web servers, also allow:

    sudo ufw allow http
    sudo ufw allow https
    

    Now you’ve got a basic firewall in place. ✅


    6. Install a Web Server

    There are two main options: Apache and Nginx. We’ll cover both.

    To install Apache:

    sudo apt install apache2 -y
    

    To install Nginx:

    sudo apt install nginx -y
    

    Once installed, test it by visiting your IP in a browser:

    http://your_vps_ip
    

    You should see the default welcome page.

    7.  Install and Configure MySQL (Optional)

    If your website needs a database (WordPress, CMS, etc.), you’ll want to install MySQL or MariaDB.

    To install MySQL:

    sudo apt install mysql-server -y
    

    Run secure installation:

    sudo mysql_secure_installation
    

    Follow the prompts to:

    • Set a root password
    • Remove anonymous users
    • Disallow remote root login
    • Remove test databases

    Test MySQL:

    sudo mysql -u root -p
    

    8.  Upload Your Website

    There are a few ways to upload your website files:

    Option 1: SFTP (recommended)

    Use an FTP client like FileZilla and connect with:

    • Protocol: SFTP
    • Host: your VPS IP
    • Username: your user
    • Password or SSH key

    Upload your site files to:

    • Apache: /var/www/html
    • Nginx: /var/www/html or your custom location

    Option 2: Git

    If you’re using Git:

    git clone https://github.com/yourrepo.git /var/www/html
    

    Set permissions:

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

    9.  Test Your Website

    Visit http://yourdomain.com (if you’ve pointed your domain to the VPS) or http://your_vps_ip.

    If you’ve set everything up, you should see your website live!

    Bonus: Enable SSL

    Use Let’s Encrypt to install a free SSL certificate:

    sudo apt install certbot python3-certbot-nginx
    sudo certbot --nginx
    

    Follow prompts to secure your site.


    10.  Monitor, Maintain & Backup

    Now that your VPS is live, keep it healthy.

    Set up automatic updates:

    sudo apt install unattended-upgrades
    

    Backup regularly:

    • Use rsync or automated tools like Duplicity
    • Consider offsite backups (VicServers offers backup services)

    Monitor performance:

    Install tools like:

    • htop – for CPU/memory usage
    • fail2ban – to block brute-force login attempts
    • ufw – to keep your firewall tuned

     Final Tips

    • Avoid running everything as root
    • Keep your OS and software up to date
    • Use strong, unique passwords or SSH keys
    • Consider installing a control panel (e.g., Webmin, VestaCP, or CyberPanel) for easier management

     Why Use Vicservers for Your VPS Hosting?

    At Vicservers, we make VPS hosting simple, secure, and scalable:

    ✅ Instant deployment
    ✅ Multiple Linux distributions
    ✅ Root access and full control
    ✅ SSD storage for fast performance
    ✅ 24/7 expert support
    ✅ Optional control panels and managed VPS plans

    Whether you’re a developer, entrepreneur, or agency, we’ve got a VPS that fits your needs and grows with you.

    Get Started with Vicservers Today!

    Ready to deploy your first VPS?

    Visit Vicservers.com
    ✔️ Choose your Linux distro
    ✔️ Pick your plan
    ✔️ Deploy in minutes

    And if you need help at any step — from setup to security — our support team is here 24/7.