0

I have two domains running on Apache 2.2 for Windows.

Domain 2 has both secure and non-secure access and works fine.

Domain 1 has the domain and four subdomains. The subdomains redirect to ports on another server on the same network. Each subdomain has its own DNS A record. The domain and subdomains are:

domain1.org media.domain1.org video.domain1.org dsm.domain1.org photo.domain1.org

Domain 1 is not in use. The subdomains all redirect to ports on a NAS.

Only the first virtual host block works. It doesn't matter which of the subdomains is listed first. If media.domain1.org is listed first, media.domain1.org will redirect correctly, but video, dsm, and photo will also redirect to the port assign for media.domain1.org.

Is this an Apache configuration issue or a DNS issue?

Thanks

Edit 1

I added NameVirtualHost this morning and it does nothing. I tried it with both inside and outside IP addresses.

I don't want to upgrade to Apache 2.4. I started with 2.4 and couldn't get it to access the directory for domain2. Using Require All Granted caused the server to not start.

I started with the Proxy statements and they didn't work at all. I do have the proxy modules loaded, but they did not forward to any ports on the NAS.

I will worry about how to access the NAS once I have the separation of the subdomains working.

Here is my virtual host structure:

<VirtualHost *:80>
ServerName media.domain1.org
Redirect / http://domain1.org:7007/
ErrorLog c:/webroot/domain1/logs/error.log
CustomLog c:/webroot/domain1/logs/access.log common
</VirtualHost>

<VirtualHost *:80>
ServerName dsm.domain1.org
Redirect / http://domain1.org:5000/
ErrorLog c:/webroot/domain1/logs/error.log
CustomLog c:/webroot/domain1/logs/access.log common
</VirtualHost>

<VirtualHost *:80>
ServerName video.domain1.org
Redirect / http://domain1.org:6006/
ErrorLog c:/webroot/domain1/logs/error.log
CustomLog c:/webroot/domain1/logs/access.log common
</VirtualHost>

<VirtualHost *:80>
ServerName domain2.com
Serveralias www.domain2.com
ErrorLog c:/webroot/domain2/logs/error.log
CustomLog c:/webroot/domain2/logs/access.log common

DocumentRoot c:/webroot/domain2
    <Directory c:/webroot/domain2>
        Options Indexes FollowSymLinks Includes
    DirectoryIndex index.html index.htm
        AllowOverride All
    Order allow,deny
    Allow from all
    </Directory>
</VirtualHost>

<VirtualHost *:443>

ServerName domain2.com
Serveralias www.domain2.com

  DocumentRoot c:/webroot/domain2
   <Directory c:/webroot/domain2>
    Options Indexes FollowSymLinks Includes
    DirectoryIndex index.html index.htm
     AllowOverride All
    Order allow,deny
    Allow from all
    </Directory>

    ErrorLog c:/webroot/domain2/logs/error.log
    CustomLog c:/webroot/domain2/logs/access.log common

       SSLEngine on
       SSLCertificateFile "c:/apache2/sslkey/certificate.crt"
       SSLCertificateKeyFile "c:/apache2/sslkey/private.key"
       SSLCertificateChainFile "c:/apache2/sslkey/ca_bundle.crt"

</VirtualHost>
3
0

I finally got this work and I also got the Proxypass working with the same fix.

Adding NameVirtualHost requires an IP address and cannot be done with a wildcard. Once an IP address is specified here the same address also needs to be in and in the Listen statements.

It didn't work with my outside IP address but did work with my inside IP address. So here is the config that works:

NameVirtualHost 192.168.x.xxx:80
Listen 192.168.x.xxx:80
Listen 192.168.x.xxx:443

<VirtualHost 192.168.x.xxx:80>

ServerName media.domain1.org

ProxyPass / http://192.168.x.xxx:7007/
ProxyPassReverse / http://192.168.x.xxx:7007/

</VirtualHost>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.