-3

how can I config apache server for bulk parking domains. I mean allow users to set DNS of server for their domains and then it show content that I set for parked domains without need of additional config in my server (a parking feature just like sedo).

I also would like to control the content based on parked domain name at next level. but I guess that would be possible from php.

m3hdi
  • 171
  • 1
  • 10

1 Answers1

0

If you define multiple VirtualHosts, all requests for a server name that you haven't configured explicitly will be served by the first VirtualHost, as explained in the examples in the Apache documentation. So you have to put the content for parked domains in the first VirtualHost.

You are right in saying that, if you want to generate custom content dynamically based on the domain name, you have to use some kind of programming language (and PHP is one popular choice).

In a PHP script, you will see the correct host name, as specified by the browser that is visiting your parking page, as $_SERVER['SERVER_NAME'], as long as you do not turn on the UseCanonicalName directive in Apache (the default is off, and it should stay that way).

pino42
  • 915
  • 5
  • 11
  • this not works. what i need is that everyone could be able to see my content just by setting DNS. i do not want to manually config every domain in my server and set every ServerName in VirtualHost. – m3hdi Nov 06 '12 at 14:07
  • You don't have to! Apache will automatically serve the content you have specified in the *first* `VirtualHost`. No need to manually configure each domain. – pino42 Nov 06 '12 at 14:08
  • so then I get same ServerName in php not? I should set ServerName in virtualhost config. – m3hdi Nov 06 '12 at 14:11
  • and also how about bind? how should I config it too? – m3hdi Nov 06 '12 at 14:13
  • As far as PHP is concerned, I edited my answer. You should not configure bind, or any other DNS server, at all; you mentioned that your users will configure their domains so the A records will point to your server's IP address, and that is all you need. You don't have to run a DNS responder on your server. – pino42 Nov 06 '12 at 17:27