webmail.domain.tld dont work :(

Discussion in 'Installation/Configuration' started by Ripeed, Nov 30, 2011.

  1. Ripeed

    Ripeed Member

    Hi, I have working domain.tld/webmail. But when I do the step 20.2 Squirrel mail in this tutor. And I want webmail.domain.tld that dont work.

    If I remove # from:
    <VirtualHost 1.2.3.4:80> <- i put there my IP
    DocumentRoot /usr/share/squirrelmail
    ServerName webmail.example.com <-there i put my domain
    </VirtualHost>

    Then every site on my server goes on http://domain.tld/webmail/src/login.php
    If I try webmail.domain.tld -> goes on http://domain.tld/webmail/src/login.php
    If I try www.domain.tld -> goes on http://domain.tld/webmail/src/login.php

    I doing something wrong:( PLS help.

    Thanks for reply.
     
  2. pititis

    pititis Member

    You need:

    1) Create subdomain in ispconfig pointing to your webmail
    2) Add a dns entry for this subdomain

    Cheers!
     
  3. Ripeed

    Ripeed Member

    Thanks, but I create the subdomain. And I set the A DNS for it. And still dont work. The same... every site domain.tld on server goes on the squirrelmail exept the subdomain.domain.tld there is the default web. Any other ideas?

    :) meaby I dont understant... What you think with "create subdomain that will pointing to your webmail" I will pointing with CNAME to domain.tld/webmail?
     
    Last edited: Nov 30, 2011
  4. pititis

    pititis Member


    Example (in Subdomain for website Tab):

    Host: webmail
    Domain: yourdomain.tld
    Redirect type: R,L
    Redirect path: http://yourdomain.tld:8080/webmail/

    Be careful with the / at the end.
     
  5. Ripeed

    Ripeed Member

    OK, now i have it. But if I open webmail.domain.tld then it redirect me to domain.tld/webmail/src/login.php

    It is posible have it like this:
    I open webmail.domain.tld and it will stay as this webmail.domain.tld/src/login.php?

    It must work like this:)

    I dont know why it not work in configuration of squrrelmail:

    vi /etc/apache2/conf.d/squirrelmail.conf

    <VirtualHost 1.2.3.4:80>
    DocumentRoot /usr/share/squirrelmail
    ServerName webmail.example.com
    </VirtualHost>

    If i use this way, then every domain on my server pointing to /usr/share/squirrelmail :(
     
  6. falko

    falko Super Moderator

  7. Ripeed

    Ripeed Member

    What you mean with "flags"? :) Thanks

    I have it like this:

    Host: webmail
    Domain: domain.cz
    Redirect type: R,L
    Redirect path: http://domain.cz/webmail/

    It work like this:
    I type webmail.domain.cz and in url shows domain.cz/webmail/src/login.php

    And I want this:
    I type webmail.domain.cz and in url stay as webmail.domain.cz/src/login.php

    Thanks a lot for help falko.
     
    Last edited: Dec 2, 2011
  8. falko

    falko Super Moderator

    With flags I refer to the "Redirect type" field.
     
  9. Ripeed

    Ripeed Member

    I try every option on redirect and nothing. Still the same.

    Meaby I must change sometning in .htaccess? It is possible?
     
  10. cbj4074

    cbj4074 HowtoForge Supporter

    From what I gather, you want to create a subdomain, e.g., webmail.example.com, via which your webmail software is accessible.

    Further, you want webmail.example.com to remain in the browser's address field, even though the "actual" location of the webmail software may reside elsewhere, whether within Apache's document root or not.

    Correct?

    There is an important proviso mentioned in the step of the tutorial to which you refer: "Also make sure that the vhost webmail.example.com does not exist in ISPConfig [emphasis mine] (otherwise both vhosts will interfere with each other!)."

    You don't need to create a redirect in ISPConfig, either.

    Either you need to follow the tutorial exactly (don't create the subdomain in ISPConfig) or, if you'd rather manage the subdomain in ISPConfig, you need to:

    1.) Create the domain (not subdomain, as those are simply aliases) in ISPConfig, e.g., webmail.example.com. Again, do not specify a redirect of any kind for the domain.

    2.) Create an A-record for webmail.example.com in your DNS configuration, wherever that might reside, and point it to your server's IP address.

    3.) Create an alias for SquirrelMail in your Apache configuration.

    Concerning step 3, add the following to the subdomain's Apache configuration in ISPConfig (Sites -> webmail.example.com -> Options -> Apache Directives box):

    Code:
    Alias / /usr/share/squirrelmail
    
    It will take up to one minute for the Apache Directives change to take effect. You can review the change's status in ISPConfig (Monitor -> Show jobqueue).

    Be aware that you may receive "Permission denied" errors when you visit webmail.example.com until you configure additional permissions.

    But let us know when you get to that point...
     
    Last edited: Dec 8, 2011
  11. Ripeed

    Ripeed Member

    OK, I do the step 3 in (Sites -> webmail.example.com -> Options -> Apache Directives box) not in the examlpe.com as you type. I hope soo it is right.

    Then I have it:) Forbidden

    Now what next? Thanks
     
  12. cbj4074

    cbj4074 HowtoForge Supporter

    Yes, that's correct; you should be entering the Apache directives in webmail.example.com, not example.com. I apologize for the typo and have corrected my previous post.

    Given that you are indeed receiving permission denied errors, your configuration is correct thus far.

    The issue now is the permissions on the /usr/share/squirrelmail directory. More specifically, the user with whose credentials the webserver is running lacks sufficient access.

    So, you need to set appropriate permissions on the /usr/share/squirrelmail directory. To be able to do this correctly and securely, we need to know which PHP implementation are you using? Mod-PHP, Fast-CGI, SuPHP, etc.

    Also, what are the current permissions on this directory? List out the parent directory's contents:

    Code:
    # ls -lah /usr/share
    
    I'm looking for something like this:

    Code:
    drwxr-xr-x   4 root root 4.0K Aug 12 07:05 squirrelmail
    
    It would also be helpful if you list the contents of the directory, too, e.g.:

    Code:
    # ls -lah /usr/share/squirrelmail
    
    We'll await your response...
     
  13. Ripeed

    Ripeed Member

    Thanks again.

    I think I am using mod-php. I proceeded by tutorial The Perfect Server.

    I am looking on phpinfo, but i dont find anythink like php implementation...

    Code:
    # ls -lah /usr/share
    drwxr-xr-x  12 root root 4.0K Nov 28 13:07 squirrelmail
    
    Code:
    # ls -lah /usr/share/squirrelmail
    total 52K
    drwxr-xr-x  12 root root 4.0K Nov 28 13:07 .
    drwxr-xr-x 145 root root 4.0K Dec  5 10:08 ..
    drwxr-xr-x   5 root root 4.0K Nov 28 13:07 class
    lrwxrwxrwx   1 root root   17 Nov 28 13:07 config -> /etc/squirrelmail
    drwxr-xr-x   4 root root 4.0K Nov 28 13:07 functions
    drwxr-xr-x  29 root root 4.0K Nov 28 13:07 help
    drwxr-xr-x   2 root root 4.0K Nov 28 13:07 images
    drwxr-xr-x   3 root root 4.0K Nov 28 13:07 include
    -rw-r--r--   1 root root  671 Aug  8 11:44 index.php
    drwxr-xr-x  53 root root 4.0K Nov 28 13:07 locale
    drwxr-xr-x  20 root root 4.0K Nov 28 13:07 plugins
    drwxr-xr-x   2 root root 4.0K Nov 28 13:07 po
    drwxr-xr-x   2 root root 4.0K Nov 28 13:07 src
    drwxr-xr-x   3 root root 4.0K Nov 28 13:07 themes
    
    :) thats it.
     
    Last edited: Dec 8, 2011
  14. cbj4074

    cbj4074 HowtoForge Supporter

    It's easy enough to double-check which mode you're using ;). Just go to Sites -> Website -> example.com and look at the menu selection next to "PHP", near the bottom of the page.

    This is on the webmail.example.com domain, by the way.
     
  15. cbj4074

    cbj4074 HowtoForge Supporter

    After installing SquirrelMail myself and examining the Apache logs concerning the message that you now receive in the browser, "Forbidden: You don't have permission to access / on this server", I found the following:

    Code:
    [error] [client 184.74.75.65] client denied by server configuration: /usr/share/squirrelmailindex.php
    [error] [client 184.74.75.65] client denied by server configuration: /usr/share/squirrelmailfavicon.ico
    
    These messages indicate that the permission denial is happening at the Apache level (not the filesystem level), which is good. Also, your permissions on the /usr/share/squirrelmail directory are correct, so no need to change those. (As a side note, it is undesirable to change the default permissions on files/directories created via package installers. Doing so should always be a last resort.)

    To allow access to that directory, it is necessary to add something similar to the following to your Apache configuration (ignore the first [Alias] line if you've already added that):

    Code:
    Alias / /usr/share/squirrelmail/
    <Location />
    Options +FollowSymLinks
    order allow,deny
    allow from all
    </Location>
    
    Once ISPConfig has written the change to disk, is the problem resolved?
     
    Last edited: Dec 13, 2011
  16. cbj4074

    cbj4074 HowtoForge Supporter

    I should mention also that the method for accessing SquirrelMail at webmail.example.com, as described in the tutorial, does work. (Before attempting it, however, please see my posts in this related thread for common pitfalls regarding the cited tutorial: http://www.howtoforge.com/forums/showthread.php?t=52042&page=4 .)

    That said, a more robust implementation would be to create a copy of the default SquirrelMail configuration file for Apache (these instructions are Debian-specific [which includes Ubuntu], so adapt accordingly)

    Code:
    # cp /usr/share/squirrelmail/config/apache.conf /etc/apache2/.conf/squirrelmail.conf
    
    and then replace the default <VirtualHost></VirtualHost> section

    Code:
    #<VirtualHost 1.2.3.4>
    #  DocumentRoot /usr/share/squirrelmail
    #  ServerName webmail.example.com
    #</VirtualHost>
    
    with:

    Code:
    <VirtualHost *:80>
    DocumentRoot /usr/share/squirrelmail
    ServerName webmail.example.com
    </VirtualHost>
    
    <VirtualHost *:443>
    DocumentRoot /usr/share/squirrelmail
    ServerName webmail.example.com
    </VirtualHost>
    
    Don't forget to reload Apache:

    Code:
    # service apache2 force-reload
    
    This adaptation accounts for any IP address and for SSL connections.
     
    Last edited: Dec 13, 2011
  17. Ripeed

    Ripeed Member

    :) ok its fast-cgi
     
  18. Ripeed

    Ripeed Member

    OK, now its work!!!!

    what i do:

    add this:
    <VirtualHost *:80>
    DocumentRoot /usr/share/squirrelmail
    ServerName webmail.example.com
    </VirtualHost>

    <VirtualHost *:443>
    DocumentRoot /usr/share/squirrelmail
    ServerName webmail.example.com
    </VirtualHost>

    that still wont work. After that i added this:
    <Location />
    Options +FollowSymLinks
    order allow,deny
    allow from all
    </Location>

    And NOW IT IS!!!!

    THANK YOU SOOO MUTCH!
     
    Last edited: Dec 13, 2011
  19. cbj4074

    cbj4074 HowtoForge Supporter

    :cool: Glad to hear it!
     

Share This Page