1

I have a standard Apache/2.4.7 setup on Ubuntu 14.04.3 LTS. It has a few virtual hosts.

I changed from an old config for this virtual host to a new one by a2ensite the new and a2dissite the old. The contents aren't important but I'll include them for completeness:

old-thing.conf did a redirect

<VirtualHost *:80>
  ServerName       thing.mysite.com
  Redirect permanent / http://otherthing.mysite.com/
  <Location />
    Order allow,deny
    Allow from all
  </Location>
</VirtualHost> 

new-thing.conf does a reverse proxy

<VirtualHost *:80>    
  ServerName       thing.mysite.com
  ProxyRequests Off
  ProxyPreserveHost On
  <Proxy *>
    Order deny,allow
    Allow from all
  </Proxy>
   ProxyPass        / http://123.123.123:80/
   ProxyPassReverse / http://123.123.123:80/
  <Location />
    Order allow,deny
    Allow from all
  </Location>
</VirtualHost>

I have restarted Apache. When I run apachectl -S I see:

port 80 namevhost thing.mysite.com (/etc/apache2/sites-enabled/new-thing.conf:1)

This tells me that Apache is using the new configuration file. But when I fetch the domain I see the redirect as it was specified in old-thing.conf.

$ curl -v http://thing.mysite.com
> GET / HTTP/1.1
> User-Agent: curl/7.35.0
> Host: thing.mysite.com
> Accept: */*
>
< HTTP/1.1 301 Moved Permanently
< Date: Wed, 23 Mar 2016 18:36:34 GMT
* Server Apache/2.4.7 (Ubuntu) is not blacklisted
< Server: Apache/2.4.7 (Ubuntu)
< Location: http://thing.mysite.com/
< Content-Length: 329
< Content-Type: text/html; charset=iso-8859-1
<
< etc...

I am puzzled. The old config is long gone. I have restarted Apache and there is no cache in the client as I'm using curl. There is another test virtualhost (shown by apache -S) which is also not recognised. Something weird is going on. Could it somehow be caching the old config?

I do not understand how it can be using the old configuration.

Any ideas?

  • Did you "gracefully" restart apache? Sometimes it doesn't really reconfigure everything when you do that. – Dan Pritts Mar 23 '16 at 21:05
  • I did a full (non-graceful) restart. Are you suggesting that the internal configuration could be out of sync with tat shown by apachectl -S? – Joe Mar 24 '16 at 8:01
  • Try if clearing your browser cache helps. – Sven Mar 24 '16 at 8:46
  • Like I said, I'm using curl which has no cache. – Joe Mar 24 '16 at 9:40
  • No, if you did a full restart you can ignore that concern. Seems though that you must have either a config being used you aren't expecting, or perhaps an entirely different httpd binary. Ensure that the httpd binary you are running is the one you think it is (poke around in /proc, use lsof, etc). Ensure that it really did get restarted (with ps). – Dan Pritts Mar 24 '16 at 21:22

Your Answer

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

Browse other questions tagged or ask your own question.