Sunday, October 2, 2011

Creating Virtual Hosts in Apache

I am sure most of what I am writing is available on the Apache Documentation but posting this so that it will be helpful for Users to configure Simple Virtual Hosts easily and faster. 

To start with "What is a VIRTUAL HOST"??
It is a method of Hosting multiple domain names on a server using a Single IP address. This allows sharing of resources of one server such as memory, processor cycles etc which lead to efficient utilization of the resources increasing the efficiency.

Now all of us know Apache is the HTTP Web Server which stores and maintains large number of Websites, It is designed to achieve a very high performance. To configure Virtual Host in Apache is very simple. It involves performing a few steps:


1.Firstly, Install the new Apache Web Server from the http://httpd.apache.org/ site. The downloads for all the OS are available.

2.After installation the Apache will be present in the following directory by default in case of Windows:  "C:\Program Files\Apache Software Foundation\Apache2.X" or "C:\Program Files (x86)\Apache Software Foundation\Apache2.X" in case if 64-bit machines.The httpd.conf file is present under the "conf" folder.
To create Virtual hosts define the following entries in the httpd.conf file which is present under "C:\Program Files\Apache Software Foundation\Apache2.X\conf" directory.

3.Open the file.In the beginning of the file there will be an entry to Listen on a particular port. By default the port is 80.
To create Virtual Hosts which run on port 81 and 82, include the lines after the Listen 80 line ie:            
    Listen 80 
    Listen 81                
    Listen 82
   .  
 
4.Now go to the bottom of the file and search for the entry:
         # Virtual hosts
         #Include conf/extra/httpd-vhosts.conf
       
5.Add the following under the entry:
          NameVirtualHost *:81
          NameVirtualHost *:82


         <VirtualHost *:81>
         DocumentRoot "C:\Program Files\Apache Software Foundation\Apache2.2\htdocs1"
         ServerName www.example1.com


         # Other directives here


         </VirtualHost>


         <VirtualHost *:82>
        DocumentRoot "C:\Program Files\Apache Software Foundation\Apache2.2\htdocs2"
        ServerName www.example2.org


        # Other directives here


       </VirtualHost>
    Note: The directory htdocs1 and htdocs2 should be created.
 6.Edit the hosts file located under the System32/drivers/etc/ directory. Add the two entries:
           <ip_address of the machine> www.example1.com         
           <ip_address of the machine> www.example2.com

 7.Save the file and close it. restart the Apache Web server either from Services or console.
 Access the link : http://www.example1.com:81/. It should redirect the control to the htdocs1 directory.Place few files in this directory. It must be served.
 Similary, accessing http://www.example2.com:82/ should be redirected to htdocs2 directory. To access the htdocs folder http://localhost:80/ will do.

Thus, We have setup a dedicated Virtual Host setup in Apache. 

459 comments:

  1. Nicely explained. Here you described the well written article from your in-depth knowledge. Truly impressive and nice information

    Java Training in Chennai Core Java Training in Chennai Core Java Training in Chennai

    Java Online Training Java Online Training JavaEE Training in Chennai Java EE Training in Chennai

    ReplyDelete
  2. virtual answering service of Marhaba Reception will help you understand the client even when you are not available. Nobody misses an important call using virtual office receptionist. To know more about it contact us marhabareception.com

    ReplyDelete
  3. Thanks a lot very much for the high quality and results-oriented help. I won’t think twice to endorse your blog post to anybody who wants and needs support about this area.Rprogramming Training in pune

    Rprogramming Training in Bangalore

    Rprogramming Training in btm

    Rprogramming Training in bangalore

    Rprogramming Training in tambaram

    Rprogramming Training in annanagar

    ReplyDelete
  4. Thank you for sharing such valuable information and tips. This can give insights and inspirations for us; very helpful and informative! Would love to see more updates from you in the future.

    Selenium training in chennai
    Selenium training institute in Chennai
    iOS Course Chennai
    Digital Marketing Training in Chennai
    php courses in chennai
    PHP Training in Velahery
    French Classes in Chennai

    ReplyDelete
  5. This is really too useful and have more ideas and keep sharing many techniques. Eagerly waiting for your new blog keep doing more.
    Aws Training in Bangalore
    Aws Course in Bangalore
    Best Aws Training in Bangalore
    hadoop classes in bangalore
    hadoop institute in bangalore

    ReplyDelete
  6. I wondered upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I’ll be subscribing to your feed and I hope you post again soon.
    Selenium testing training
    Selenium Courses in Chennai
    Selenium training Chennai
    Software Testing Training in Chennai
    Software Testing Courses in Chennai
    Software Training Institutes in Chennai

    ReplyDelete
  7. I'm really glad that I came across your post. I was searching for this information. Thanks for sharing.
    LINUX Training in Chennai | LINUX Course | Best LINUX Training institute in Chennai | LINUX Course in Chennai

    ReplyDelete
  8. I think this is the best article today about the future technology. Thanks for taking your own time to discuss this topic, I feel happy about that curiosity has increased to learn more about this topic.Artificial Intelligence Training in Bangalore. Keep sharing your information regularly for my future reference.

    ReplyDelete
  9. Hey Nice Blog!! Thanks For Sharing!!!Wonderful blog & good post.Its really helpful for me, waiting for a more new post. Keep Blogging!
    SEO company in coimbatore
    SEO company
    web design company in coimbatore

    ReplyDelete
  10. Thanks for sharing this information admin, it helps me to learn new things. Continue sharing more like this.
    Regards,
    Tableau training in Chennai | Tableau Courses Training in Chennai | Tableau training Institute in Chennai

    ReplyDelete
  11. many peoples want to join random whatsapp groups . as per your demand we are ready to serve you whatsapp group links . On this website you can join unlimited groups . click and get unlimited whatsapp group links

    ReplyDelete
  12. Are your preparing for government examination? Effective preparation is important to be successful, make use of our TNPSC Current affairs to prepare for your TNPSC & other government examination.

    ReplyDelete


  13. It has been simply incredibly generous with you to provide openly what exactly many individuals would’ve marketed for an eBook to end up making some cash for their end, primarily given that you could have tried it in the event you wanted.
    Data Science Training in Chennai | Data Science Course in Chennai
    Python Course in Chennai | Python Training Course Institutes in Chennai
    RPA Training in Chennai | RPA Training in Chennai
    Digital Marketing Course in Chennai | Best Digital Marketing Training in Chennai

    ReplyDelete
  14. Thanks for sharing valuable information.It will help everyone.keep Post.
    Kerala Lottery guessing

    ReplyDelete
  15. Thank you for this great article i learn a lot from your article keep it up.
    WordPress with LEMP Stack

    ReplyDelete
  16. Alleyaaircool is the one of the best home appliances repair canter in all over Delhi we deals in repairing window ac, Split ac , fridge , microwave, washing machine, water cooler, RO and more other home appliances in cheap rates

    Window AC Repair in vaishali
    Split AC Repair in indirapuram
    Fridge Repair in kaushambi
    Microwave Repair in patparganj
    Washing Machine Repair in vasundhara
    Water Cooler Repair in indirapuram
    RO Service AMC in vasundhara
    Any Cooling System in vaishali
    Window AC Repair in indirapuram

    ReplyDelete
  17. Get the best nursing services baby care services medical equipment services and allso get the physiotherapist at home in Delhi NCR For more information visit our site

    nursing attendant services in Delhi NCR
    medical equipment services in Delhi NCR
    nursing services in Delhi NCR
    physiotherapist at home in Delhi NCR
    baby care services in Delhi NCR

    ReplyDelete
  18. Thank you for excellent article.You made an article that is interesting.
    Tavera car for rent in chennai|Indica car for rent in chennai|innova car for rent in chennai|mini bus for rent in chennai|tempo traveller for rent in chennai
    Keep on the good work and write more article like this...

    Great work !!!!Congratulations for this blog


    ReplyDelete
  19. Wow it is really wonderful and awesome thus it is very much useful for me to understand many concepts and helped me a lot. it is really explainable very well and i got more information from your blog.
    Kindly visit us @
    Top HIV Hospital in India | Best AIDS Hospital in India
    HIV AIDS Treatment in Bangalore | HIV Specialist in Bangalore
    Best HIV Doctor in India
    Cure best blood cancer treatment in Tamilnadu

    ReplyDelete
  20. Excellent Blog. I really want to admire the quality of this post. I like the way of your presentation of ideas, views and valuable content. No doubt you are doing great work. I’ll be waiting for your next post. Thanks .Keep it up!
    Kindly visit us @
    Luxury Boxes
    Premium Packaging
    Luxury Candles Box
    Earphone Packaging Box
    Wireless Headphone Box
    Innovative Packaging Boxes
    Wedding gift box
    Leather Bag Packaging Box
    Cosmetics Packaging Box
    Luxury Chocolate Boxes

    ReplyDelete
  21. Wow, amazing blog layout! How long have you been blogging for? you make blogging look easy. The overall look of your website is fantastic, let alone the content!

    3D animation Company
    Chatbot Development Company
    Android app development in Coimbatore

    ReplyDelete
  22. Great post thanks for the share,
    You may know that Telegram is a great social media platform with lot of useful groups and channels, so you may like Telegram Group Links

    ReplyDelete
  23. Making this type of website is not easy. You can contact Digi Instiller SEO Company for all types of Digital Marketing Services like SEO, SMM, PPC Ads, etc.

    ReplyDelete
  24. Thanks for the Valuable information.Really useful information. Thank you so much for sharing.It will help everyone.Keep Post. Find Some Indian Memes. Interesting News Tamilrockers Movie Download Trending News Some Life hacks tips Life hacks Entertainment News Find Some Viral News Here.Trending News
    saurabh jindal

    ReplyDelete
  25. Thank for sharing such great info with us,i learned something new.

    Now a day this technology creating lot of buzz in the current IT market which is also creating lot's of job opportunities to those tech enthusiasts who are keen to explore the technology and get the advantage of this. interesting right! then have a look of the world trending technology from the Big Data Hadoop certification course in Bangalore and more info.

    ReplyDelete
  26. Wonderful article!!! It is very useful for improve my skills. This blog makes me to learn new thinks. Thanks for your content.
    ORACLE TRAINING IN CHENNAI

    ReplyDelete
  27. PUBG Mobile Lite need minimum 2GB of RAM is claimed as per the official requirements

    ReplyDelete
  28. Thanks for sharing valuable information.It will help everyone.keep Post.
    Kerala Lottery Guessing

    ReplyDelete
  29. Thanks for the information. The one thing I have noticed in this website is that you were continuously updating the changes that you have been made. It is a good sign to attract more people and I appreciate it. Hope more update and news from you.

    Matlab Training in Chennai | Robotics Training in Chennai | Machine Learning Training in Chennai | PHP Training in Chennai | Java Training in Chennai | Big Data Training in Chennai | Android Training in Chennai | Web Design Training in Chennai | Python Training in Chennai

    ReplyDelete
  30. Cool post .. amazing blog. I really appreciate your effort. Thanks for sharing. Please Check Sai Baba Images and Life Quotes in Hindi

    ReplyDelete
  31. amazing post written ... It shows your effort and dedication. Thanks for share such a nice post.
    Life Quotes in Hindi and funny wifi names reddit

    ReplyDelete
  32. This comment has been removed by the author.

    ReplyDelete
  33. Best post .. I really like your hard work and impressive writing style. Thanks for sharing. Keep Writing. Please visit - Sai Baba Images and Good Morning Love

    ReplyDelete
  34. awesome blog.
    https://www.kaashivinfotech.com/summer-internship-in-chennai/
    https://www.kaashivinfotech.com/summer-internship-in-chennai/
    https://www.kaashivinfotech.com/winter-internship-in-chennai/
    https://www.kaashivinfotech.com/online-internships/

    ReplyDelete
  35. For Devops Training in Bangalore visit:Devops Training in Bangalore

    ReplyDelete
  36. Best post .. I really like your hard work and impressive writing style. Thanks for sharing. Keep Writing. Please visit - Sai Baba Images and Good Morning Love

    ReplyDelete
  37. Very interesting information blog post, my favorite this post, thanks a lot for these amazing content.
    Assignment Help
    Online Assignment Help
    programming homework help

    ReplyDelete
  38. This comment has been removed by the author.

    ReplyDelete
  39. Usually I never comment on blogs but your article is so convincing that I never stop myself to say something about it. You’re doing a great job Man, Keep it up.
    Veteran Mode, MLive Mod APK, Layon Shop, Multitas Pinjaman, Brasil Tv New, Project IGI, Enlight Pixaloop Pro, Gimy TV, Sakura Live Show China, TR Vibes HotStar

    ReplyDelete
  40. Assignment Help is the best solution to fix the issues of assignment writing at affordable rates. Get your homework completed in one click. For more information, talk to our experts.

    ReplyDelete
  41. Thank you for sharing the valuable information. Thanks for providing a great informatic blog, really nice required information & the things I never imagined. Thanks you once again Download Ludo King Mod Apk

    ReplyDelete
  42. Today Launch in india New Jawa Bike is Jawa Anniversary Edition Price at 1.73 lakh (ex-showroom), to mark the 90th year of the brand.

    ReplyDelete
  43. This is the first & best article to make me satisfied by presenting good content. I feel so happy and delighted.By Learn Digital Marketing Course Training in Chennai it will help to get Digital Marketing Training with Placement Institute in Chennai. If you Learn Social Media Marketing Training with Placement Institute in Chennai, you will get job soon.

    Learn Best Digital Marketing Course Training in Chennai in professional institute to get reputed job.

    ReplyDelete
  44. KTM Bike launch a super bike KTM 790 Duke in India at a price of Rs. 8.64 Lakh ex-showroom Delhi, Check it MotoBike

    ReplyDelete
  45. Thanks for sharing this valuable information to our vision. You have posted a trust worthy blog keep sharing.

    Best phones under 10000
    Top 10 best mobile phones in india
    Best phones under 20000
    Coolpad 35031 model
    Mobiles
    Best phones under 5000

    ReplyDelete
  46. Hello Admin!

    Thanks for the post. It was very interesting and meaningful. I really appreciate it! Keep updating stuffs like this. If you are looking for the Advertising Agency in Chennai / Printing in Chennai , Visit us now..

    ReplyDelete
  47. Nice information, you write very nice articles, I visit your website for regular updates
    the hindu pdf

    ReplyDelete
  48. We provide the assignment at the cheapest price.24/7 hours Allassignmenthelp is always ready for you in times of emergency. Write My Assignment Cheap

    ReplyDelete
  49. Nice information, you write very nice articles, I visit your website for regular updates.
    current affairs august 2019 yojana magazine pdf download in hindi

    ReplyDelete
  50. Wow What A Nice And Great Article, Thank You So Much for Giving Us Such a Nice & Helpful Information, please keep writing and publishing these types of helpful articles, I visit your website regularly.
    bag trends 7 bags every girl should have

    ReplyDelete
  51. This is very helpful content and I also want to say that Starting a YouTube channel in 2020 is very important.

    ReplyDelete
  52. Thank you for sharing such valuable information and tips...
    IoT Training in Bangalore | Internet of Things Course | IoT Course in Bangalore - Tecmax - Tecmax offers the Best IoT Training in Bangalore, We offer Real-Time Job Oriented IoT Training with Live Projects,
    Our IoT (Internet of Things) Trainers are Working Professionals with 4+ years of Expertise in IoT, we also provide 100% Placement Assistance after IoT Course Completion.

    ReplyDelete
  53. Very Nice article thank you for share this good article 먹튀검증

    ReplyDelete
  54. Wow What A Nice And Great Article, Thank You So Much for Giving Us Such a Nice & Helpful Information, please keep writing and publishing these types of helpful articles, I visit your website regularly.
    school fee management software

    ReplyDelete
  55. Thanks for sharing the knowledge. So useful and practical for me. I learned something new. Very well written. It was so good to read and useful to improve knowledge. If you are looking for any R programming related information, check our R Programming training institute in bangalore web page. Thanks a lot.

    ReplyDelete

  56. Best Article buy Pain Pills online Excellent post. I appreciate this site. Stick with it! Because the admin of this web page is working, no doubt very quickly it will be well-known, due to its quality contents.This website was how do you say it? Relevant!! Finally, I’ve found something that helped me.
    Best Article buy Roxicodone online Excellent post
    buy Xanax online
    buy Oxycodone online

    Best Article buy Pain Medications online Excellent post. I appreciate this site. Stick with it! Because the admin of this web page is working, no doubt very quickly it will be well-known, due to its quality contents.This website was how do you say it? Relevant!! Finally, I’ve found something that helped me.

    buy Research Chemicals online

    buy Roxicodone online

    buy Cbd Isolate online

    ReplyDelete
  57. 'I'm highly impressed by the piece of thoughts you have shared on this portal. all the best
    connect us on Assignment Help can shed your burden of assignments with a return of qualitative assignments.

    ReplyDelete
  58. Thanks a lot for sharing
    Having good health is what most people out there wants but can not achieve. some people takes buy ibogaine online AND buy weed online to get it.

    ReplyDelete
  59. I can only imagine how much research has gone into this. I like your writing skills as it makes one feel included in the journey. Thank you for the valuable notes.
    Assignment Help
    Dissertation Writing Services

    ReplyDelete
  60. This comment has been removed by the author.

    ReplyDelete
  61. Assignment Help Australia services are the best options to submit pending assignments on time without taking stress of missing due dates. Check out our website for more information about online academic writing services in Australia.
    Assignment Help
    Assignment Help Online
    Online Assignment Help
    Assignment Help Online Services
    Assignment Helper
    Assignment Assistance
    Assignment Help Experts
    Online Assignment Help Services

    ReplyDelete
  62. thank you for share this wonderful information 파워볼사이트

    ReplyDelete


  63. 2 of 65
    comment

    Tuhin Pabna
    Attachments
    Nov 28, 2019, 9:29 AM
    to noyon0461


    2 Attachments

    keep up the good work. this is an Assam post. this to helpful, i have reading here all post. i am impressed. thank you. this is our digital marketing training center. This is an online certificate course
    digital marketing training in bangalore / https://www.excelr.com/digital-marketing-training-in-bangalore

    ReplyDelete
  64. Really i found this article more informative, thanks for sharing this article! Also Check here

    Download and install Vidmate App which is the best HD video downloader software available for Android. Get free latest HD movies, songs, and your favorite TV shows

    Vidmate App Download

    Vidmate apk for Android devices

    Vidmate App

    download Vidmate for Windows PC

    download Vidmate for Windows PC Free

    Vidmate Download for Windows 10

    Download Vidmate for iOS

    Download Vidmate for Blackberry

    Vidmate For IOS and Blackberry OS

    ReplyDelete