VirtualHost / subdomain problems
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Hi, I have a computer with windows xp32 behind a router that has apache 2.2.1.0. The router has a static ip and I configured it to redirect to the computer that has apache. I also tested it works from a computer at a different location, a basic "It works!" page can be requested.
I pointed a domain name to this static ip address. I created three subdomains pointing to @, which means they all point to the same static ip address. I tested from the remote computer and this works, the test page can be retrieved.
I wanted to use virtual hosts so that if I typed the static ip address on my browser, the server would respond as if it was a request to the root folder.
If I typed the domain name (no subdomain), the server would respond as if it was a request to the root folder.
If I typed the domain name with a subdomain (one of them being www), the server would respond as if it was a request to a SUBFOLDER, each subdomain has a subfolder with the same name as the subdomain within htdocs, one folder has a index.php file that contains phpinfo();, the other two are empty.
No matter what I do I can only get all subdomain, domain and ip requests to point to the root OR to the first subdomain folder I entered on httpd.conf, all at the same time, so I am unable to achieve my objective.
File structure:
==========
F:/web/Apache2210/htdocs/
F:/web/Apache2210/htdocs/index.html -> "It works!"
F:/web/Apache2210/htdocs/subdomains/
F:/web/Apache2210/htdocs/subdomains/a/
F:/web/Apache2210/htdocs/subdomains/a/index.php -> "<?php phpinfo(); ?>"
F:/web/Apache2210/htdocs/subdomains/b/
F:/web/Apache2210/htdocs/subdomains/c/
Here is my latest configuration, I put this at the end of httpd.conf:
===============================================
<VirtualHost *>
DocumentRoot "F:/web/Apache2210/htdocs"
DirectoryIndex index.html
#index.html exists at that folder
</VirtualHost>
<VirtualHost *>
ServerName a.abcde.com
ServerAlias a.abcde.com
DocumentRoot "F:/web/Apache2210/htdocs/subdomains/a"
DirectoryIndex index.php
#index.php exists at that folder
</VirtualHost>
<VirtualHost *>
ServerName b.abcde.com
ServerAlias b.abcde.com
DocumentRoot "F:/web/Apache2210/htdocs/subdomains/b"
DirectoryIndex index2.php
#index2.php doesn't exist
</VirtualHost>
<VirtualHost *>
ServerName c.abcde.com
ServerAlias c.abcde.com
DocumentRoot "F:/web/Apache2210/htdocs/subdomains/c"
DirectoryIndex index3.php
#index3.php doesn't exist
</VirtualHost>
<VirtualHost *>
ServerName abcde.com
ServerAlias abcde.com *.abcde.com
DocumentRoot "F:/web/Apache2210/htdocs"
DirectoryIndex index.html
#index.html exists at that folder
</VirtualHost>
There are no typos on the censored domain/subdomain names, just checked again.
For testing I tried to open:
===================
1. IP address
2. abcde.com
3. a.abcde.com
All three returned index.html
Then tried the other two subdomains and they return index.html.
If I change the order so that a.abcde.com's virtualhost is first then all my results become index.php.
Yes, I save the config then reset apache.
NameVirtualHost
=============================
Originally I didn't have NameVirtualHost but now I have this line before the virtualhost definitions:
NameVirtualHost <static ip address>:80
I can't seem to do what everyone can, I hope I am just missing something simple.
[Index of Archives]
[Open SSH Users]
[Linux ACPI]
[Linux Kernel]
[Linux Laptop]
[Kernel Newbies]
[Security]
[Netfilter]
[Bugtraq]
[Squid]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Samba]
[Video 4 Linux]
[Device Mapper]