How to Create an Apache 2 Virtual Host on Linux Mint 19 Easy Guide

April 23, 2019 | By the+gnu+linux+evangelist | Filed in: Tutorial.

Setting Up

  1. 2. Editing Hosts

    Add the Domain to the hosts Config File

    sudo nano /etc/hosts

    If Got “User is Not in Sudoers file” then see: How to Enable sudo
    Append:	[]

    Just Substitute Your real Domain Name to “[]” :)
    Ctrl+Shift+v to Paste Content into nano
    Ctrl+x to Save and Exit from nano Editor

  2. 3. Making VHost Folder

    Create the VHost Target Directory

    sudo mkdir /var/www/html/[]

    And may be also a Testing index.html:

    sudo su -c 'echo "The New Web-Site is Working on Apache2!" > /var/www/html/[mySite]/index.html'

    Then Set the Domain’s Ownership with:

    sudo chown -R www-data:www-data /var/www/html/[]
  3. 4. Making VHost Config File

    Now Create a VHost Config File

    sudo nano /etc/apache2/sites-available/[myDomainName].conf

    Append at Least:

    <VirtualHost *:80>	
    ServerName	[]
    ServerAlias	www.[]
    DocumentRoot /var/www/html/[]

    Possibly substitute the actual Port to 80.
    To get a little More Insight may look:

    cat /etc/apache2/sites-available/000-default.conf
  4. 5. Enabling VHost

    Enabling the New Virtual-Host

    cd /etc/apache2/sites-enabled
    sudo ln -s ../sites-available/[myDomainName].conf .

    Finally, Restart Apache2 Web Server

    sudo service apache2 restart
  5. How to Enable Apache2 mod_rewrite Module on Mint

    Enabling Apache2 Rewrite for Mint

    How to Create a IP-based Virtual Host on Linux Mint

    How to Create an IP-Based Virtual Host on Mint

    Debian Apache2 IP Virtual-Host


Tags: , , , , , , , , , , , , , , , ,

QuickChic Theme • Powered by WordPress