Results 1 to 2 of 2

Thread: Apache - Difference between defaultserver and VirtualHost

  1. #1
    eeijlar NNTP User

    Default Apache - Difference between defaultserver and VirtualHost


    Hi,

    I am trouble figuring out the difference between the contents of
    default-server.conf and user defined hosts such as
    /v.hosts/virtualhost.conf

    In the default server there is a default configuration:


    Code:
    --------------------
    DocumentRoot "/srv/www/htdocs"
    --------------------


    And say I have in <VirtualHost ipaddress:443>


    Code:
    --------------------
    DocumentRoot "/var/www/htdocs"
    --------------------


    This won't work. I have to change the default server to be the same as
    the VirtualHost


    Code:
    --------------------
    DocumentRoot "/var/www/htdocs"
    --------------------


    In which case I don't see the point of having a virtual host at all. I
    might as well have the whole thing configured in the default server. I
    am running into problems with this as there are two instances of the
    server running:

    Default Server on port 80
    Virtual Host on port 443

    When I browse to *http*, the site that is supposed to be at *https* is
    appearing. I want to put in a redirect for requests to port 80 but they
    both seemed to be bound up together. The port 80 "version" of the site
    doesn't work at all as the PHP code there is expecting https.

    Any ideas?

    /jlar


    --
    eeijlar
    ------------------------------------------------------------------------
    eeijlar's Profile: http://forums.opensuse.org/member.php?userid=1504
    View this thread: http://forums.opensuse.org/showthread.php?t=400983


  2. #2
    Kevin Miller NNTP User

    Default Re: Apache - Difference between defaultserver and VirtualHost

    eeijlar wrote:
    > Hi,
    >
    > I am trouble figuring out the difference between the contents of
    > default-server.conf and user defined hosts such as
    > /v.hosts/virtualhost.conf
    >
    > In the default server there is a default configuration:
    >
    >
    > Code:
    > --------------------
    > DocumentRoot "/srv/www/htdocs"
    > --------------------
    >
    >
    > And say I have in <VirtualHost ipaddress:443>
    >
    >
    > Code:
    > --------------------
    > DocumentRoot "/var/www/htdocs"
    > --------------------
    >
    >
    > This won't work. I have to change the default server to be the same as
    > the VirtualHost
    >
    >
    > Code:
    > --------------------
    > DocumentRoot "/var/www/htdocs"
    > --------------------
    >
    >
    > In which case I don't see the point of having a virtual host at all. I
    > might as well have the whole thing configured in the default server. I
    > am running into problems with this as there are two instances of the
    > server running:
    >
    > Default Server on port 80
    > Virtual Host on port 443
    >
    > When I browse to *http*, the site that is supposed to be at *https* is
    > appearing. I want to put in a redirect for requests to port 80 but they
    > both seemed to be bound up together. The port 80 "version" of the site
    > doesn't work at all as the PHP code there is expecting https.
    >
    > Any ideas?


    Did you edit listen.conf? You probably need to edit it and put in a
    line telling apache to listen for the virtual host. Something like

    Listen 443
    NameVirtualHost *:443

    Also, if you're connecting on 443, you'll need to use https:// instead
    of just http:// in the browser.

    You don't have to use a different port for a virtual host. They can all
    listen on 80. Apache will direct to the correct directory based on the
    name. I.e., var.niftydomain.com will go to the /var/www/htdocs
    directory and srv.niftydomain.com will go to /srv/www/htdocs.

    HTH...

    ....Kevin
    --
    Kevin Miller
    http://www.alaska.net/~atftb
    Juneau, Alaska
    Registered Linux User No: 307357, http://counter.li.org

Posting Permissions

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