$schemamarkup = get_post_meta(get_the_ID(), 'schemamarkup', true); if(!empty($schemamarkup)) { echo $schemamarkup; }

How to Create An Apache Virtual Host on Debian Bullseye

August 31, 2021 | By the+gnu+linux+evangelist.

Name Based VHost

  1. 1. Accessing Shell

    Login into Server Shell.
    Or Open a Command Line Terminal Window
    (Press “Enter” to Execute Commands)

    Open Terminal
  2. 2. Adding Domain

    Add Domain to the hosts Config File
    Crating it with the nano Editor:

    sudo nano /etc/hosts

    And append:

    127.0.0.1 [myDomainName.com]
    

    Just Replace your real Domain Name to “[myDomainName.com]” :)
    Ctrl+Shift+v to Paste Content on nano
    Ctrl+x to Save and Exit from nano Editor

  3. 3. Making Directory

    Create the VHost Target Directory
    Running:

    sudo mkdir /var/www/html/[mySite]

    Again Replace [mySite] in the above!
    And may be also a Testing index.html:

    su -c 'echo "My New WebSite is Working! :)" > /var/www/html/[mySite]/index.html'

    The above is just a siple Testing Content.
    Last, Set the Folder’s Ownership with:

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

    Now Create a VHost Config File
    Again with nano:

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

    Append at Least:

    <VirtualHost *:80>
    ServerName[myDomainName.com]
    ServerAliaswww.[myDomainName.com]
    DocumentRoot /var/www/html/[mySite]
    </VirtualHost>
    

    To get a little More Insight may look:

    cat /etc/apache2/sites-available/000-default.conf
  5. 5. Enabling Virtual-Host

    Next to Enable the New Virtual-Host
    Access the Target Folder:

    cd /etc/apache2/sites-enabled

    And make a Symlink:

    sudo ln -s ../sites-available/[myDomainName].conf .
  6. 6. Restarting Apache

    Restart Apache2 Web Server
    Simply play:

    sudo service apache2 restart

    How to Enable Apache2 mod_rewrite Module on Debian.

    Enabling Apache2 Rewrite for Debian
  7. Contents