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:
DocumentRoot "/srv/www/htdocs"
And say I have in
DocumentRoot "/var/www/htdocs"
This won’t work. I have to change the default server to be the same as the VirtualHost
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.
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.