Custom dns: bad_httpd_conf


#1

Hi. I just signed up for Deamhost, and I’m having a little trouble setting up my domains.

I pointed feareye.us at Dreamhost’s name servers, and then created an A record for a “test” subdomain. It’s the same as the “non-editable” records, “208.97.145.9”. It also let me add a wildcard, “*”. I thought you guys didn’t support wildcards? Anyway, neither of those new records seem to be working. I get “bad_httpd_conf”.

So I tried setting up a second domain, dogtownladies.com, the way I had it with my old hosting provider, by keeping Godaddy’s nameservers and changing the main A record there to “208.97.145.9”. That also comes up “bad_httpd_conf”.

What’s going on here? Both names have been added in the control panel under “Manage Domains”, but only the automatic DNS records on Dreamhost’s nameservers seem to work. I wasn’t expecting wildcards to work, but I hope I have the option of using other nameservers, at least.


#2

I suspect that your issue isn’t related to DNS. First off, has the DNS changes had time to propigate? - you’re getting the bad_httpd_conf from dreamhost? If that’s the case it’s odd that both of your domains got erros, but a simple search of this forum would have reveled the answer. Log into the Panel > Domains > Manage Domains > edit (for the domains in question) and click to save changes. Even though you didn’t make any changes.

This will set your httpd_conf to be re-written, which may well fix your problem. If it doesn’t you’ll have to contact support.

-Matttail


#3

Yeah, I did try regenerating the file, and I know the DNS has propagated because the default records work fine. It’s only records I add myself, either on dreamhost’s name servers or godaddy’s, that return bad_httpd_conf.

Is it possible to get to httpd.conf through telnet or something and see what’s going on?


#4

no, I don’t believe that you can - the file is owned by apache and is stored elsewhere. I think your best bet is to contact support.

-Matttail


#5

You’re just going about it the wrong way.

If you want to add a subdomain, you need to add it in the panel (if you want to serve identical content, make it a mirrored domain; otherwise, make it a fully hosted domain). As someone said, the DNS isn’t the problem. The problem in this case is that the webserver isn’t configured to accept requests for that domain / subdomain.

Also, if you want the wildcard to work, it’ll have to point to a domain / subdomain that has a unique IP, since there’s no way to create a wildcard virtual host from the panel.

e.g., create “test.example.com” with a unique IP, then make *.example.com a CNAME to test.example.com.


#6

Man, wouldn’t it be absolutely DREAMY to someday have control over our own portions of httpd.conf? Perhaps some way to submit edits and then a script to error check & recompile a new master http.conf on some regular schedule? I don’t think this could be realistically done in real time, but perhaps several times a day, or something.

Just dreaming out loud … as if these wasn’t already enough on the future dream list. :slight_smile:


#7

For example:

Dynamically Configured Mass Virtual Hosting:
Using a Separate Virtual Host Configuration File

http://httpd.apache.org/docs/2.0/vhosts/mass.html#xtra-conf

The techniques described here are of interest if your httpd.conf contains many sections that are substantially the same, for example:

NameVirtualHost 111.22.33.44
<VirtualHost 111.22.33.44>
ServerName www.customer-1.com
DocumentRoot /www/hosts/www.customer-1.com/docs
ScriptAlias /cgi-bin/ /www/hosts/www.customer-1.com/cgi-bin

<VirtualHost 111.22.33.44>
ServerName www.customer-2.com
DocumentRoot /www/hosts/www.customer-2.com/docs
ScriptAlias /cgi-bin/ /www/hosts/www.customer-2.com/cgi-bin

blah blah blah

<VirtualHost 111.22.33.44>
ServerName www.customer-N.com
DocumentRoot /www/hosts/www.customer-N.com/docs
ScriptAlias /cgi-bin/ /www/hosts/www.customer-N.com/cgi-bin

The basic idea is to replace all of the static configurations with a mechanism that works them out dynamically. This has a number of advantages:

  1. Your configuration file is smaller, so Apache starts more quickly and uses less memory.
  2. Adding virtual hosts is simply a matter of creating the appropriate directories in the filesystem and entries in the DNS - you don’t need to reconfigure or restart Apache!

This arrangement uses more advanced mod_rewrite features to work out the translation from virtual host to document root, from a separate configuration file. This provides more flexibility, but requires more complicated configuration.

The vhost.map file should look something like this:

www.customer-1.com /www/customers/1
www.customer-2.com /www/customers/2

www.customer-N.com /www/customers/N

The httpd.conf should contain the following:

RewriteEngine on

RewriteMap lowercase int:tolower

define the map file

RewriteMap vhost txt:/www/conf/vhost.map

deal with aliases as above

RewriteCond %{REQUEST_URI} !^/icons/
RewriteCond %{REQUEST_URI} !^/cgi-bin/
RewriteCond ${lowercase:%{SERVER_NAME}} ^(. )$

this does the file-based remap

RewriteCond ${vhost:%1} ^(/.)$
RewriteRule ^/(.
)$ %1/docs/$1

RewriteCond %{REQUEST_URI} ^/cgi-bin/
RewriteCond ${lowercase:%{SERVER_NAME}} ^(. )$
RewriteCond ${vhost:%1} ^(/.)$
RewriteRule ^/(.
)$ %1/cgi-bin/$1 [T=application/x-httpd-cgi]