logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: vhost.conf overriding httpd.conf
Author
oktrik



Joined: 23 Sep 2021
Posts: 6
Location: NTT

PostPosted: Thu 23 Sep '21 13:50    Post subject: vhost.conf overriding httpd.conf Reply with quote

hi

i have windows server with ip let say 123.456.789.123 and i've installed apache on it (httpd-2.4.49-win64-VS16.zip)

on httpd.conf i left everything as default except enabling virtual host (uncomment httpd-vhosts.conf from httpd config line)

my virtual host is configured like this

Code:
<VirtualHost *:80>
     ServerAdmin info@domain.com
     ServerName domain.com
    ServerAlias wwww.domain.com
     DocumentRoot "C:\httpd\htdocs\www"
    <Directory "C:\httpd\htdocs\www">
    Options Indexes FollowSymLinks MultiViews Includes ExecCGI
    AllowOverride All
    Order Allow,Deny
    Allow from all
    Require all granted
</Directory>
    DirectoryIndex DirectoryIndex index.php index.htm index.html
     ErrorLog "C:\httpd\logs\site2.your_domain_error.log"
     CustomLog "C:\httpd\logs\site2.your_domain_access.log" common
<IfModule dir_module>
    DirectoryIndex index.php index.html
</IfModule>
</VirtualHost>


my problem is im expecting my server ip will load apache default welcome page "ITS WORKS" when i load via http://123.456.789.123
but it load my virtual host instead ..so both of http://123.456.789.123 and http://wwww.domain.com load my virtual host directory

only after i commented #Include conf/extra/httpd-vhosts.conf http://123.456.789.123 load proper directory..but this mean i cant add my domain

can someone help me

Thank you
Back to top
Otomatic



Joined: 01 Sep 2011
Posts: 213
Location: Paris, France, EU

PostPosted: Thu 23 Sep '21 17:56    Post subject: Reply with quote

Hi,

I am not an Apache expert, but I see several problems:

You should not use backslash \ you should use slash /

Directory should be ended by a slash /

It is better to put a + sign in front of each Options

"Order Allow, Deny Allow from all" is useless, it's a leftover from Apache 2.2. Require all granted is enough.

Why DirectoryIndex DirectoryIndex ?
Back to top
oktrik



Joined: 23 Sep 2021
Posts: 6
Location: NTT

PostPosted: Fri 24 Sep '21 6:34    Post subject: Reply with quote

thankyou otomatic for pointing it out,im copy paste the configuration from online article, is the configuration ok now?...i ended up with this configuration..this one solved the issue on http but im still having the same issue on https(ssl) version


Code:
<VirtualHost *:80>
    # primary server
    DocumentRoot "C:/httpd/htdocs/"
    <Directory "C:/httpd/htdocs/">
    Require all granted
</Directory>
</VirtualHost>

<VirtualHost *:80>
     ServerAdmin info@domain.com
     ServerName domain.com
    ServerAlias wwww.domain.com
     DocumentRoot "C:/httpd/htdocs/www/"
    <Directory "C:/httpd/htdocs/www/">
    Options +Indexes FollowSymLinks MultiViews Includes ExecCGI
    AllowOverride All
    Require all granted
</Directory>
         ErrorLog "C:/httpd/logs/site2.your_domain_error.log"
     CustomLog "C:/httpd/logs/site2.your_domain_access.log" common
<IfModule dir_module>
    DirectoryIndex DirectoryIndex index.php index.htm index.html
</IfModule>
</VirtualHost>
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7373
Location: Germany, Next to Hamburg

PostPosted: Wed 29 Sep '21 13:52    Post subject: Re: vhost.conf overriding httpd.conf Reply with quote

oktrik wrote:
hi

i have windows server with ip let say 123.456.789.123 and i've installed apache on it (httpd-2.4.49-win64-VS16.zip)

on httpd.conf i left everything as default except enabling virtual host (uncomment httpd-vhosts.conf from httpd config line)

my virtual host is configured like this

Code:
<VirtualHost *:80>
     ServerAdmin info@domain.com
     ServerName domain.com
    ServerAlias wwww.domain.com
     DocumentRoot "C:\httpd\htdocs\www"
    <Directory "C:\httpd\htdocs\www">
    Options Indexes FollowSymLinks MultiViews Includes ExecCGI
    AllowOverride All
    Order Allow,Deny
    Allow from all
    Require all granted
</Directory>
    DirectoryIndex DirectoryIndex index.php index.htm index.html
     ErrorLog "C:\httpd\logs\site2.your_domain_error.log"
     CustomLog "C:\httpd\logs\site2.your_domain_access.log" common
<IfModule dir_module>
    DirectoryIndex index.php index.html
</IfModule>
</VirtualHost>


my problem is im expecting my server ip will load apache default welcome page "ITS WORKS" when i load via http://123.456.789.123
but it load my virtual host instead ..so both of http://123.456.789.123 and http://wwww.domain.com load my virtual host directory

only after i commented #Include conf/extra/httpd-vhosts.conf http://123.456.789.123 load proper directory..but this mean i cant add my domain

can someone help me

Thank you


You need to add one or two vhosts per domain. One for port 80 and one for port 443. And yes, as soon as you add a vhost the main host from the httpd.conf disappears. Just add more vhosts.

#7000
Back to top


Reply to topic   Topic: vhost.conf overriding httpd.conf View previous topic :: View next topic
Post new topic   Forum Index -> Apache