Need help with httpd.conf

Discussion in 'Apache' started by dawilster, Dec 17, 2008.

  1. #1
    My host provider has horrible customer service, anyway I'm trying to create wildcard DNS entry for this script that i purchased Echophp which is a free forum hoster that creates forums under a subdomain.

    Anyway I'm having trouble adjusting my httpd.conf for wildcard dns. i searched the whole httpd.conf and I was supposed to make an entry that looked similar to this

    ServerAlias yourdomain.com
    ServerAdmin webmaster@yourdomain.com
    DocumentRoot /home/yourdoma/public_html
    BytesLog domlogs/yourdomain.com-bytes_log
    ServerName www.yourdomain.com
    User yourdomain
    Group yourdomain
    CustomLog /usr/local/apache/domlogs/yourdomain.com combined
    ScriptAlias /cgi-bin/ /home/yourdomain/public_html/cgi-bin/
    Code (markup):
    But the closest thing i could find was


    #<VirtualHost *:80>
    #    ServerAdmin webmaster@dummy-host.example.com
        DocumentRoot /www/docs/dummy-host.example.com
    #    ServerName dummy-host.example.com
    #    ErrorLog logs/dummy-host.example.com-error_log
    #    CustomLog logs/dummy-host.example.com-access_log common
    #</VirtualHost>
    Code (markup):
    Please someone help me out, i'll even pay you for your help.

    thanks alot
     
    dawilster, Dec 17, 2008 IP
  2. pr0t0n

    pr0t0n Well-Known Member

    Messages:
    243
    Likes Received:
    10
    Best Answers:
    10
    Trophy Points:
    128
    #2
    Those lines that you mentioned you found in your httpd.conf are the right place to look, however those should not be commented with # on the beginning of the line. lines in httpd.conf which have # on the start of the line are treated just as some comments, and won't be parsed by apache. You know that, right?

    Before changing anything I STRONGLY recommend to backup your httpd.conf first. So if you mess something up, you will be able to restore it to old conf file, instead of having your apache down.

    So... you didn't provided any additional info regarding that script you are trying to install, but I'm guessing you have installed it in your main html folder, right? And you have some .htaccess file there in your main html folder that will parse those redirected subdomains to proper script, right? In this case... you should search for the line in your httpd.conf that looks like this:

    
    ServerName yourdomain.com
    
    Code (markup):
    Or may look like this as well:
    
    ServerName www.yourdomain.com
    ServerAlias yourdomain.com
    
    Code (markup):
    or some similar variation...

    If it doesn't have that ServerAlias line (somewhere between that <VirtualHost ...> and </VirtualHost>) then you should add this line right bellow that ServerName line:
    
    ServerAlias *.yourdomain.com
    
    Code (markup):
    If you already have some setting for ServerAlias in your virtualhost setting, then you should just modify it, instead of addiing that line. So if your ServerAlias line looked like mentioned one ServerAlias yourdomain.com then just add your wildcarded subdomain to look like this:
    
    ServerAlias yourdomain.com *.yourdomain.com
    
    Code (markup):
    That's just one blank space between those two entries. If you have more entries in that ServerAlias line, then just add *.yourdomain.com at the end. Make sure you haven't broken line structure in your httpd.conf , and if you haven't then just save, and restart your apache server. Once again, make sure you have a backup of your httpd.conf file before starting this whole process.

    That should work. It should point all wildcarded subdomains to your main html folder. If you have some .htaccess file there which will know what to do with incoming visitors, then you are done. If not, then you will probably need some rulles in your .htaccess to redirect those subdomains to proper script , probably.

    This will probably make all your valid subdomains not to work as previously configured, and will be redirected per that subdomain wildcard rulle. If you need to keep some subdomains working as they were until now, and have this rule with wildcarded subdomains applied, then your httpd.conf will need more modifications. But maybe you won't need that...
     
    pr0t0n, Dec 17, 2008 IP
  3. dawilster

    dawilster Active Member

    Messages:
    844
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    58
    #3
    Thanks alot for the clarification but the info i provided above were about the closest thing i could find to the

    ServerName www.yourdomain.com
    ServerAlias yourdomain.com

    And i even ctrl w and tried looking for my domain without any luck, am i looking in the right place etc/conf/httpd/httpd.conf?

    thanks
     
    dawilster, Dec 17, 2008 IP
  4. pr0t0n

    pr0t0n Well-Known Member

    Messages:
    243
    Likes Received:
    10
    Best Answers:
    10
    Trophy Points:
    128
    #4
    Oh I see.. so you do not even see yourdomain mentioned anywhere in your httpd.conf? Huh that depends on the server configuration then... Does your httpd.conf have some "Include ... " lines? Try ctrl+w and search for the word "Include" without the quotes of course. If it does, then maybe your specific site is configured in some external conf file which is just included in httpd.conf then. It depends on the type of the server. For example I know that Ensim servers are configured that way... each site's apache configuration is stored in external .conf file which is included then in main httpd.conf . If you are not sure you are looking into the right httpd.conf then try this:
    
    locate httpd.conf
    
    Code (markup):
    via ssh line, and it should print you back all httpd.conf files it has found on your server.
     
    pr0t0n, Dec 17, 2008 IP