Find the answer to your Linux question:
Results 1 to 5 of 5
I want to run a website that is both HTTP and HTTPS. How do I go about with the configuration file? Lets says I have a configuration file for example.com.. ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Banned
    Join Date
    Aug 2011
    Posts
    43

    Serving HTTP and HTTPS with Apache 2.2


    I want to run a website that is both HTTP and HTTPS. How do I go about with the configuration file?

    Lets says I have a configuration file for example.com.. do I need to create:

    <VirtualHost _default_:443>
    </VirtualHost>
    <VirtualHost *:80>
    </VirtualHost>

    or can I create:

    <VirtualHost *:80 _default_:443>
    </VirtualHost>

    I am assuming HTTPS settings are ignored when HTTP is used?


    Thanks!

  2. #2
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,411
    You need two virtual hosts.
    One for http, one for https.

    Note:
    https is actually not restricted to the port, but rather getīs enabled if you use the proper config within a virtualhost secrtion.
    You must always face the curtain with a bow.

  3. #3
    Banned
    Join Date
    Aug 2011
    Posts
    43
    I use Apache 2.2.14-5ubuntu8.4. As you may be aware, the dumb ****s over at Canonical changed the structural layout of this version of Apache over the official version.
    So, I have a sites-available directory that contains the configuration files and sites-enabled directory that holds the symbolic link pointing to the relative configuration file, which makes the website 'live' and accessible to the world.

    This is what I don't get...

    If I make the symbolic link 'example.com', then its going to point to 'example.com' configuration file, but then how am I also going to make it 'link-in' with the SSL configuration file? I can't make a symbolic link exampe.com-ssl and link to a configuration file with the same name, because that won't be my domain name and will not be served when the request is made... so, thats why I am asking if I point the symbolic link to 'example.com' configuration file, and if I use a SSL configuration file with this in it:

    <VirtualHost *:80 _default_:443>
    </VirtualHost>

    Where non-relative SSL setting will be ignored when HTTP is being served.

    ... or a configuration file with both:

    <VirtualHost _default_:443>
    </VirtualHost>
    <VirtualHost *:80>
    </VirtualHost>

    ... where the relative VirtualHost is selected depending on which protocol is being used?

    Do you know what I mean?
    Last edited by Kolusion; 08-17-2011 at 05:35 AM.

  4. $spacer_open
    $spacer_close
  5. #4
    Just Joined!
    Join Date
    Aug 2011
    Posts
    1
    Nice information post over here.This is useful for web server apache 2.2.

  6. #5
    Banned
    Join Date
    Aug 2011
    Posts
    43
    So I tried:

    <VirtualHost *:80>
    bla bla bla
    </VirtualHost>
    <VirtualHost *:443>
    bla bla bla
    </VirtualHost>

    .. and it worked. Solved.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •