Re: Main domain and virtual hosts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Kurtis,

I checked this morning and everything seems to be working now. I made a lot of DNS changes, so it probably just took some time to sort out. I am going to dig a little more just to make sure I did not miss something. I answered your questions below for the record.

On Aug 31, 2015, at 9:39 PM, Kurtis Rader <krader@xxxxxxxxxxxxx> wrote:

Works for me. I'm running v2.4.16. What version of Apache HTTPD are you running? According to the docs the NameVirtualHost "directive currently has no effect." And the default behavior changed with v2.3.11. So I'm wondering if you're running v2.2.*.

Apache version 2.2.31


If you issue a "host example.com 8.8.8.8" command on a UNIX like system does it report "example.com has address <myIP>”?

Yes it resolves to the correct IP


Also, when you say it "does not work and gets into a redirect loop"  how did you determine that? Did you do a controlled test with a CLI tool like curl with verbose (-v) output enabled and observe that you received a HTTP 301 redirect? Or did something else occur?

Chrome displayed a redirect loop error page, I did not check further.


What does the Apache HTTPD access and error logs show? Setting "LogLevel debug" might be necessary to get messages relevant to this problem.

A lot of 302 lines, but then all of a sudden a 200 and now it works.

MyHomeIP - - [01/Sep/2015:12:22:52 +0000] "GET /index.php/login HTTP/1.1" 302 364 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36"
MyHomeIP - - [01/Sep/2015:12:22:52 +0000] "GET /index.php/login HTTP/1.1" 302 364 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36"
MyHomeIP - - [01/Sep/2015:12:22:52 +0000] "GET /index.php/login HTTP/1.1" 302 364 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36"
MyHomeIP - - [01/Sep/2015:12:22:52 +0000] "GET /index.php/login HTTP/1.1" 302 364 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36"
MyHomeIP - - [01/Sep/2015:12:23:23 +0000] "GET /index.php/login HTTP/1.1" 200 8513 "-" "Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X; en-us) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 



On Mon, Aug 31, 2015 at 6:01 PM, Warren Bell <warrenbell2@xxxxxxxxx> wrote:
I have 3 virtual hosts set up like this:

<VirtualHost *:80>
  ServerName www.example.com
  ServerAlias example.com
  DocumentRoot /var/www/html/example
  ErrorLog /var/www/html/example/error.log
  CustomLog /var/www/html/example/requests.log combined
</VirtualHost>

<VirtualHost *:80>
  ServerName www.site1.example.com
  ServerAlias site1.example.com
  DocumentRoot /var/www/html/site1
  ErrorLog /var/www/html/site1/error.log
  CustomLog /var/www/html/site1/requests.log combined
</VirtualHost>

<VirtualHost *:80>
  ServerName www.site2.example.com
  ServerAlias site2.example.com
  DocumentRoot /var/www/html/site2
  ErrorLog /var/www/html/site2/error.log
  CustomLog /var/www/html/site2/requests.log combined
</VirtualHost>

httpd.conf has the following uncommented:

NameVirtualHost *:80

and the following commented

#ServerName www.example.com:80

My DNS has A records

example.com -> myIP
*.example.com -> myIP

myIP is the same for both records.

site1.example.com works fine and goes to the correct site.

site2.example.com works fine and goes to the correct site.

example.com does not work and gets into a redirect loop.

What do I need to configure to get example.com to work ?

Thanks,

Warren Bell



--
Kurtis Rader
Caretaker of the exceptional canines Junior and Hank


[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]

  Powered by Linux