If you want to provide your whole config file, I suggest creating a gist or pastebin post. You should also just run dig or host on the domain name from both machines and make sure you get the same results.
- Y On Sun, Feb 5, 2017 at 8:25 PM, Spork Schivago <sporkschiv...@gmail.com> wrote: > So you don't think it's a bug in Apache? Okay. I only have two IP > addresses. One is an IPv4 IP address, one is an IPv6 IP address. When I > get some more time, I'll try some experimenting and see if I can duplicate > the issue. If it's okay with the mailing list, I'd like to provide a copy > of my entire Apache configuration file. I'd really like to try and > understand what exactly happened. There was no ServerName > www.example.com anywhere in the Apache config file, there was no > ServerAlias www.example.com in the Apache config file. I think I might > understand what you're saying. > > On the remote server, when I ran curl, maybe it converted www.example.com > to the IP address, so instead of going to www.example.com, I was actually > going to 192.168.2.2, for example. I've looked at my hosts file, I have an > entry for hostname.domain.com, but nothing for www.domain.com. > > On Sun, Feb 5, 2017 at 7:38 PM, Yehuda Katz <yeh...@ymkatz.net> wrote: > >> This is a common enough setup that it is unlikely to be a bug and more >> likely to be a configuration error. >> >> cPanel creates VirtualHosts using the IP address of the server. For >> example, I have a cPanel server running behind NAT, so there are two >> default virtual hosts: >> >>> <VirtualHost 192.168.118.82:80> >>> ServerName 192.168.118.82 >>> DocumentRoot /var/www/html >>> ServerAdmin hostmas...@example.com >>> <IfModule suphp_module> >>> suPHP_UserGroup nobody nobody >>> </IfModule> >>> </VirtualHost> >>> <VirtualHost *> >>> ServerName ph04.example.com >>> DocumentRoot /var/www/html >>> ServerAdmin hostmas...@example.com >>> <IfModule suphp_module> >>> suPHP_UserGroup nobody nobody >>> </IfModule> >>> </VirtualHost> >> >> >> The actual account Virtual Host uses the IP address in the VirtualHost >> block, so the default that would be selected would be the one with the IP >> address: >> >> <VirtualHost 192.168.118.82:80> >>> ServerName example.net >>> DocumentRoot /home2/example_net/public_html >>> ServerAdmin webmas...@example.net >> >> >> would fall back to the first Virtual Host because it is more specific. >> >> If there is a different IP for the website on one of your systems - for >> example in the hosts file - that would cause it to all back to a different >> Virtual Host than you expect because the IP doesn't match. >> >> - Y >> >> >> On Sun, Feb 5, 2017 at 6:44 PM, Spork Schivago <sporkschiv...@gmail.com> >> wrote: >> >>> Yehuda, >>> >>> Could you please explain what you mean in a little more detail? I only >>> have one server running Apache and I only have that one DNS server. I >>> don't really see how my DNS server could be setup in such away where it >>> affects Apache's DocumentRoot's directive... >>> >>> When I was logged into the remote server running Apache, Apache was >>> serving files from a different directory than it was when I was accessing >>> Apache via my local machine. I hope that makes sense. Looking at my >>> Apache conf log, when I was accessing Apache from my local machine, it was >>> acting properly, because I didn't have a VirtualHost setup for the www >>> host, but when I was accessing Apache from the server that was running >>> Apache, it was serving files from the domain.com VirtualHost directory. >>> ServerAliases have been commented out. To my knowledge, this should >>> not happen. >>> >>> I can probably regenerate it. I've restarted the server and >>> everything, but I was thinking maybe this was some sort of bug and not a >>> misconfigured server. >>> >>> On Sun, Feb 5, 2017 at 4:47 PM, Yehuda Katz <yeh...@ymkatz.net> wrote: >>> >>>> Did you check your DNS to make sure both systems are resolving to the >>>> same IP address? >>>> >>>> - Y >>>> >>>> >>>> On Thu, Jan 26, 2017 at 3:31 PM, Spork Schivago < >>>> sporkschiv...@gmail.com> wrote: >>>> >>>>> I have a bit of a weird problem that I'd like some help tracking down. >>>>> I'm pretty sure it's something with Apache. In my Apache 2.4.25 >>>>> (cPanel) config file, I have the ServerAliases disabled. There's a >>>>> "catch-all" entry for unbound IPs, that look like this: >>>>> >>>>> <VirtualHost *> >>>>> ServerName myhostname.mydomain.com >>>>> DocumentRoot /var/www/html >>>>> ServerAdmin myrealem...@someplace.com >>>>> >>>>> <IfModule suphp_module> >>>>> suPHP_UserGroup nobody nobody >>>>> </IfModule> >>>>> >>>>> </VirtualHost> >>>>> >>>>> Further down, I have a VirtualHost entry for mydomain.com, which has >>>>> a DocumentRoot of /home/<myusername>/public_html >>>>> >>>>> I setup a test file, /home/<myusername>/public_html >>>>> /.well-known/acme-challenge/test that says www.mydomain.com-test. >>>>> >>>>> Then I setup another test file, >>>>> /var/www/html/.well-known/acme-challenge/test >>>>> that says myhostname.mydomain.com-test >>>>> >>>>> I have .htaccess files in /home/<myusername>/public_html that redirect >>>>> all traffic to secure ports. I have cPanel installed and have manually >>>>> setup subdomains for the various cPanel stuff. >>>>> >>>>> Anyway, when I run the following command on the remote server: >>>>> curl http://www.mydomain.com/.well-known/acme-challenge/test >>>>> >>>>> I see the 301 redirect. When I run: >>>>> curl https://www.mydomain.com/.well-known/acme-challenge/test >>>>> I see the: >>>>> www.mydomain.com-test >>>>> >>>>> >>>>> However, when I run those commands on my local Linux box instead of >>>>> the remote server that's running Apache, I see: >>>>> curl http://www.mydomain.com/.well-known/acme-challenge/test >>>>> myhostname.mydomain-test >>>>> >>>>> curl https://www.mydomain.com/.well-known/acme-challenge/test >>>>> www.mydomain.com-test >>>>> >>>>> >>>>> It's not just curl, lynx, the command line web browser, does the same >>>>> thing. On the remote computer that's running Apache, for some reason, >>>>> I'm >>>>> seeing different results than I am when I run the commands on my local >>>>> Linux box. >>>>> >>>>> Any idea what's going on? >>>>> >>>>> Thanks! >>>>> >>>>> Sincerely, >>>>> Ken Swarthout >>>>> >>>> >>>> >>> >> >