Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Senior Coder timgolding's Avatar
    Join Date
    Aug 2006
    Location
    Southampton
    Posts
    1,519
    Thanks
    114
    Thanked 110 Times in 109 Posts

    Allow 443 for only one subdomain.

    I have a development web server that is also a mail server. I want to allow my boss to send email from home. So i have set up squirrel mail. I want to somehow only allow users to connect to the server from outside to 443 to the squirrel mail but not to the rest of the server. The standard doc root for the server is one place (with development material), and i don't want that accessible from the outside only from the inside, this can be on port 80 then i just don't set up port forwarding to port 80. Then i set up port forwarding on the router to 443 for the web mail. But i don't want them to be able to access the rest of the web server through port 443, only the squirrel mail location. Is this possible? I have sub domains i can point to the server if that helps? Hope this makes sense and any help would be greatly appreciated... Thanks!
    You can not say you know how to do something, until you can teach it to someone else.

  • #2
    New Coder
    Join Date
    Jul 2011
    Posts
    67
    Thanks
    0
    Thanked 13 Times in 13 Posts
    Create a new vhost for the 443 connection using the sub-domain.

    Code:
    <VirtualHost *:443>
    ServerName sub.domain.com
    DocumentRoot /folder/for/your/mail/site
    #rest of your vhost config goes here...
    </VirtualHost>
    Then just set-up your mail scripts in the document root and jobs a good un.

  • Users who have thanked Cags for this post:

    timgolding (07-26-2011)

  • #3
    Senior Coder timgolding's Avatar
    Join Date
    Aug 2006
    Location
    Southampton
    Posts
    1,519
    Thanks
    114
    Thanked 110 Times in 109 Posts
    Thanks i followed this and it kind of works. But seems that then any subdomain connecting under https goes to that sub domain folder? Any ideas how to fix that? Maybe have any other subdomain connecting through https go to an error page would be ideal?
    You can not say you know how to do something, until you can teach it to someone else.

  • #4
    New Coder
    Join Date
    Jul 2011
    Posts
    67
    Thanks
    0
    Thanked 13 Times in 13 Posts
    If that is the only 443 sub-domain that you have then it's probably acting as a default for all requests that come in on SSL. I'm not sure what the best way to deal with that is, but personally I'd probably just use mod_rewrite to check the domain and redirect back to the unencrypted domain. Something like the following should do the trick, just place it in the 443 sub-domain that you created. Probably not 100% correct, but something along these lines should work...

    Code:
    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^mysub.domain.com
    RewriteRule .* http://%{HTTP_HOST}%{REQUEST_URI} [R=301]


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •