0

I've got a webfacing server that I've chopped up into guests, one of which is running apache with some pretty basic virtualhost config. I have redirection working, but my virtualhost config needs the original destination to work out which set of pages the request should hit, so I'm only seeing the default server page.

Currently, my iptables rule looks like this:

-A PREROUTING -i eth0 -p tcp -m tcp --dport 80 -j DNAT --to-destination 10.10.10.2:80

Any pointers?

The problem is, any http(s) traffic to this box is being routed to the default set of pages, not the one appropriate for the originally requested domain.

The appropriate part from the virtualhost config:

    #
    #  The document root + CGI-directories.
    #
    VirtualDocumentRoot     /srv/%0/public/htdocs/
    VirtualScriptAlias      /srv/%0/public/cgi-bin/

(yes, those paths do exist - I've yanked /srv/ over from the apache box I'm replacing & retained owners/permissions/etc!)

docdead
  • 1
  • 1
  • 2
    I can't tell what your problem is here. Can you spend some time editing your question, and make sure you are explicit about what you think the problem is? – Zoredache Oct 03 '13 at 16:18
  • Are those `DocumentRoot` / `ScriptAlias` directives inside of a virtual host? If so, what does the `` line look like. – USD Matt Oct 04 '13 at 11:34
  • Yes, they are - I set things up years ago using Bytemark's 'symbiosis' project, so the config looks like this: [projects.bytemark.co.uk](https://projects.bytemark.co.uk/projects/symbiosis/repository/revisions/6ea37a5f78e8/entry/apache/apache.d/zz-mass-hosting.template.erb) – docdead Oct 04 '13 at 13:02

1 Answers1

0

With virtual hosts, Apache does not use the ip address (unless using ip based virtual hosts, which Im guessing you are not) of the server to determine which website to present, so checking IPtables rules will not yield anything. Instead Apache checks the host field in the http request and uses that to decide which virtualhost to present. Odds are your Apache configuration is at fault here, not IPtables.

Edit your question to include your virtualhost configuration block.

GeoSword
  • 1,657
  • 12
  • 16