0

Environment

  • Ubuntu 12.10
  • Apache 2.2.22

Background

I'm using name-based virtual hosting. During some point in the setup I added a port 5001 to the virtual hosts list, and successfully accessed the site with this port in the url. I later removed this from the virtual hosts list, and opted for accessing the site based on the ServerAlias directive and using the same port. The list now looks like this:

    <VirtualHost *:80>
      ServerAdmin webmaster@example1
      DocumentRoot /home/example1/public_html
      Servername example1.org 
      ServerAlias *.example1.org
      ServerAlias example1.org 
    </VirtualHost>

    <VirtualHost *:80>
      ServerAdmin webmaster@example2
      DocumentRoot /home/example2/public_html
      ServerName example2.com
      ServerAlias *.example2.com
      ServerAlias example2.com
    </VirtualHost>

Problem

Despite removing port 5001 from the virtual host list and restarting Apache numerous times, visiting the site www.example2.com results in a redirect to www.example2.com:5001. What I would like is for Apache to know which root folder to go to based on the ServerAlias only. However, it seems Apache is saving this port and redirecting the URL to the same URL plus port 5001.

I've tried clearing the cache on my client, and I've tried accessing this site from different devices all with the same result.

Question

  1. What are some reasons that Apache would save a previous virtual host configuration?
  2. Is there a cache that can be cleared in Apache?
8
  • 1
    Perhaps you could do a recursive grep search for "5001" in the Apache config directory and subdirectories. It may be that another file is being used for configuration by inclusion. Also, have you looked for .htaccess files in the vhost directories?
    – SunSparc
    Jul 26, 2013 at 15:57
  • @SunSparc Thanks for the suggestions. The grep search turned up negative, and I am not using any .htaccess files. Jul 26, 2013 at 16:08
  • Are you just serving up static files? Or is there some dynamic content being served at either of those URLs?
    – larsks
    Jul 26, 2013 at 17:35
  • @larsks There are wordpress installations under each directory. Jul 26, 2013 at 17:51
  • 1
    I'm not familiar with wordpress. Is there any configuration there that may believe that it needs to use port 5001? Some web applications need to know their own "base url" and will automatically redirect to that when appropriate.
    – larsks
    Jul 26, 2013 at 17:55

1 Answer 1

1

I'm not familiar with wordpress. Is there any configuration there that may believe that it needs to use port 5001? Some web applications need to know their own "base url" and will automatically redirect to that when appropriate.

1
  • The port 5001 was not required, but wordpress did pick it up automatically during the initial installation when the site was under port 5001. So you have to go into the settings and adjust the wordpress address and site address accordingly. Jul 26, 2013 at 18:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .