Apache Virtual Hosting: IP Based and Name Based Virtual Hosts in RHEL/CentOS/Fedora

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Use our Linode referral link if you plan to buy VPS (it starts at only $10/month).
  4. Support us via PayPal donate - Make a Donation
  5. Support us by downloading our premium books in PDF format
  6. Support us by taking our online Linux course in 5 Days

We are thankful for your never ending support.

Tarunika Shrivastava

I am a linux server admin and love to play with Linux and all other distributions of it. I am working as System Engineer with a Web Hosting Company.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

Receive Your Free Complimentary eBook NOW! -

Download Free Linux eBooks

Advanced Bash-Scripting Guide
Linux Bible
A Newbie's Getting Started Guide to Linux
Introduction to Linux - A Hands on Guide

You may also like...

39 Responses

  1. Norbert says:

    Hello,
    I have one domain, do I need to add my IP address of server to their control panel (for their DNS ) ?

    Do I need to install DNS server or apache is enough ?

    Thank you

    Norbert

    • Ravi Saive says:

      @Norbert,

      Just point the domain to IP address of the server in your Hosting DNS control panel, no need to install DNS server, onl Apache is enough to run your website..

  2. Arjun Pawar says:

    i want to redirect my website from http to https. i changed many configuration like .htaccess file and httpd file but i am not getting solution. could help me.

    • Ravi Saive says:

      @Arjun,

      Create a .htaccess file in root of domain or website that you want to redirect to HTTPS and add the following rules.

      RewriteEngine On
      RewriteCond %{HTTPS} off
      RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
      
      • Arjun Pawar says:

        I have already added this code in .htaccess file in website root but i am not getting solution. i want to know you i am also unable to open website in local network from http with domain name but i able open http with ip domain address.

        • Ravi Saive says:

          @Arjun,

          Make sure that “AllowOverride All” is set in your httpd.conf file and also make sure you have added DNS ‘A’ record for you domain and point back to the server IP address.

  3. Widyachacra says:

    No it shouldn’t be the same hostname.

    You don’t have to use the same local FQDN as your vhost FQDN(ServerName). Create an ‘CNAME’ record lets say ‘www2 CNAME http://www.example1.com‘ & put the ServerName www2.example1.com. Thats all. 8-)

  4. Mrutyunjaya says:

    hii.. please help me . i want to know what is your FQDN name. if your FQDN is http://www.example1.com then, is your host name is www ???

    • Bhasker says:

      I expect FQDN can be example1.mycompany.com then domain is mycompany and example1 is host name. FQDN is nothing but host name along with domain name.

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

Join Over 95000+ Linux Users
  1. 77,543
  2. 4,213
  3. 35,218

Enter your email to get latest Linux Howto's