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
    • 708
    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 127.0.0.1 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
        </Directory>
    
        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   
    
    </VirtualHost>

     

    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
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
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: