User Space CNAMES

Discussion in 'General' started by bluethunder82, Dec 29, 2006.

  1. bluethunder82

    bluethunder82 Member

    I'm trying to locate the appropriate directive that will provide the following function. Looking through the forum I haven't found a solution.

    if a user types myname.tld.com then I will actual be viewing the user web1_myname's folder. This would be instead of typing tld.com/users/web1_myname/.

    I have tried creating a co-domain then using the forward feature however this basically redirects me to www.mytld.com/users/web1_myname. As I mention above I believe I am looking for an apache directive to provide this.

    I also don't know if it matters but I use a separate machine for DNS.

    Any thoughts or suggestions on where I might be able to hunt this down would be appreciated.
     
  2. falko

    falko Super Moderator ISPConfig Developer

  3. bluethunder82

    bluethunder82 Member

    Thanks Falko. I did some reading on the virtual host and it is exactly what I'm looking for. However I have now run into a snag - using the Perfect Setup (6.06) I am having trouble using the mod_rewrite command. I have tried posting on Ubuntu forums but have not gotten a response for some time. I'll throw this out to everyone here. I'm sure I'm missing something simple.

    So for tring to get mod_rewrite to work, thus allowing virtual users to work here is what I have troubleshooted so far.

    I have verified that mod_rewrite is enabled (mods-enabled folder, php check '<?php phpinfo(); ?>', etc). According to all the pointers mod_rewrite should be working.

    Looking in /etc/apache2/sites-enabled/000-default I have changed both instances of AllowOverride to 'all' (they were both none). As per Ubuntu forum posts.

    I have tried adding:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    </IfModule>

    To the apache2.conf file and the 000-default virtual host but neither worked. I have removed this from my files.

    With all the changes to my conf files I restart apache. As that may be an obvious miss.

    A test .htaccess file I have been using is:
    RewriteEngine On
    RewriteBase /
    RewriteRule ^/test/ http://www.google.com [R]

    (as borrowed from another post on ubuntu forum)

    What am I missing?

    thx
     
  4. falko

    falko Super Moderator ISPConfig Developer

    You can either put your directives in an .htaccess file and place it in the web site's document root, or you put the directives in the Apache Directives field of that web site in ISPConfig.
     
  5. bluethunder82

    bluethunder82 Member

    I understand that. Where my problem lies is that even when I used .htaccess or the directives field I am not getting any redirect or error message.

    It appears as though it should work but I am not having any luck. The redirect for /test/ I have does not yield anything for either method.

    Basically I'm stuck were it appears mod_rewrite is active but isn't playing nice.
     
  6. falko

    falko Super Moderator ISPConfig Developer

    I suggest you undo all your changes and then place your rewrite directives in the Apache Directives field, and if there are still problems we can try to solve them.
     
  7. bluethunder82

    bluethunder82 Member

    Ok all the changes have been reset to what would have been installed by default.

    Within the directives field I have tried both the following with no success:

    RewriteEngine On
    RewriteBase /
    RewriteRule ^/test/ http://www.google.com [R]

    And

    AllowOverride all
    RewriteEngine On
    RewriteBase /
    RewriteRule ^/test/ http://www.google.com [R]

    Also adding a .htaccess file to the root of the user I get no success either.

    Looking in the error.log file I see no errors at the time of my tests. I have a few: suEXEC mechanism enabled (wrapper: /usr/lib/apache2/suexec2) lines at around 06:30 but nothing else.

    And in the ispconfig_access_log file I just have an entry for a 404 error and nothing else written.

    Any ideas are welcomed.
     
  8. till

    till Super Moderator Staff Member ISPConfig Developer

    Please enable logging for your rewrite rules to check for errors:

    RewriteLog /tmp/rew.log
    RewriteLogLevel 3

    Normally it is not nescessary to add this line:

    RewriteEngine On

    as ISPConfig has enabled the rewrite engine in the vhost for its own rewriterules already.
     
  9. bluethunder82

    bluethunder82 Member

    Ok, I hope this isn't obvious but I have but the following in my directive and am not seeing any log created when I type tld.com/test/ . I still just get the 404 error.

    RewriteLog /tmp/rew.log
    RewriteLogLevel 3
    RewriteBase /
    RewriteRule ^/test/ http://www.google.com [R]
     
  10. till

    till Super Moderator Staff Member ISPConfig Developer

    Do you get any errors in the mail log? Did you add the RewriteLog directive in the apache directives field or in the Vhost_ispconfig.conf file directly?
     
  11. martinfst

    martinfst ISPConfig Developer ISPConfig Developer

    I see you have suexec enabled. Pls check the suexec log and check the pre-requisites for susexec at http://httpd.apache.org/docs/2.0/suexec.html. I had a hard day yesterday understanding why my redirects did not work. Finally it became clear to me that I redirected to a path outside my webroot, which is prohibited with suexec. I tried everything, ScriptAlias, apache2.conf, etc, etc. And finally the combination the suexec log, apache access AND error log, rewrite log (debug level 9) gave me the answers.
     
  12. bluethunder82

    bluethunder82 Member

    Hi Till,
    Nothing in the mail log (would there be apache logs in there ever?). I have checked all the logs in both httpd and the apache2 folders. The only entry I see in the logs is again the 404 error for the tld.com/test/.

    I added the four lines directly into the apache directives field from within the ISPConfig interface. My understanding was Vhost_ispconfig.conf gets written over by ISPConfig.


    Hi martinfst,
    I have made no changes to suexec aside from installing it through the Perfect Setup. I looked within the folder /var/log/apache2/ for the suexec.log file and the only two types of log files I found were access.log and error.log. Did the changes you needed to do require anything different then the standard install?

    Also I looked at the Perfect Setup again and read the note on suexec. I do have ispconfig storing files within /var/www/.
     
  13. falko

    falko Super Moderator ISPConfig Developer

    Till meant the Apache logs, not the mail log. :)
     
  14. bluethunder82

    bluethunder82 Member

    Figured as much. But had to ask just in case :D
     
  15. bluethunder82

    bluethunder82 Member

    Just wondering what the next step should be for getting mod_rewrite to work?

    Thx.
     
  16. bluethunder82

    bluethunder82 Member

    I was trying to solve my mod_rewrite problem this evening and have run into this note. I'm curious if it is to be expected.

    When I enter the apace directive a file Vhosts_ispconfig.conf_(date) is created and the directive is present. The Vhost_ispconfig.conf file seems to be updated as it has the same time stamp as the Vhosts_ispconfig.conf_(date) but does not contain my directive.

    Is this normal behaviour? I am still getting no entries in the error.log file, or the tmp log file or the regular access.log file. The error shows the standard page not found.
     
  17. till

    till Super Moderator Staff Member ISPConfig Developer

    This happens when you entered a directive that contains a error or that can not be handled by the apache webserver. ISPConfig tests it and if the apache webserver can not start with this configuration, the faulty config file is stores with a date appaneded and the last working configuration is used.

    To locate the error, please try this:

    http://www.howtoforge.com/forums/showthread.php?t=7719
     
  18. bluethunder82

    bluethunder82 Member

    All right I was able to find out that the test rewrite I was using had the wrong syntax for a directive. The test syntax that I borrowed from another form only is used for .htaccess files.

    I have tried many tries at getting the redirect to work. Is someone familar with mod_rewrite. I'm trying:

    RewriteEngine on
    RewriteLog /tmp/rew.log
    RewriteLogLevel 3
    RewriteCond %{HTTP_HOST} ^.+\.mydomain\.com$
    RewriteRule ^(.+) %{HTTP_HOST}$1 [C]
    RewriteRule [^.]+\.mydomain\.com(.*) /var/www/web1/user/web1_$1$2

    I am getting the "shared IP" notice so I know the DNS record is setup correctly. Still there are no error's being generated.

    I have tried several other directives to change the document root as per several tutorials but am not having luck. I believe mod_rewrite is working just the nut behind the wheel now needs to learn the black art of mod_rewrite.

    Ideas are always welcome as Im sure there are others that have or want the same functionality.
     
  19. till

    till Super Moderator Staff Member ISPConfig Developer

    No, this means that the DNS-Record is NOT set correctly for the website! If you get the shared IP notic, then the DNS-Record points not to the IP of the website. Please correct either the IP of the DNS-Record or the IP of the website.
     
  20. bluethunder82

    bluethunder82 Member

    So if I understand you I should still add the co-domain within ISPConfig even thought I do not use that machine for DNS? I'm using a dedicated machine for all my DNS records running QuickDNS.
     

Share This Page