Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
  • How to setup Virtual Domain Name on apache2 Ubantu

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 724
    Comment on it

    Step 1 :- Create new project like /var/www/html/staging/blog
    Step 2:- create index.php 
    Step 3:- Write <?php echo “Hello World”; ?> inside index.php
    Step 4:- Check If you can access project via http://localhost/staging/blog. If you can see Hello World on your browser. Your are ready to create virtual domain
    Step 5:- Add domain name in /etc/hosts file. e.g blog.staging.local
    Step 6: Open CLI Switch to sudo mode using sudo -i
    Step 7:- Create copy using “cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/blog-staging-local.conf
    Step 8:- Edit /etc/apache2/sites-available/blog-staging-local.conf

    <VirtualHost *:80>
        ServerAdmin webmaster@localhost
        ServerName blog.staging.local
        DocumentRoot /var/www/html/staging/blog/public
        <Directory />
                Options FollowSymLinks
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                require all granted
        ErrorLog /var/www/html/staging/blog.error.log
        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn
      CustomLog /var/www/html/staging/blog.access.log combined   


    Step 9:- Make site avialable using “sudo a2ensite blog-staging-local”
    Step 10:- Restart the apache using “service apache2 reload”


    Note :- You should have sudo access to follow this tutorial

 0 Comment(s)

Sign In

Sign up using

Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: