Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: Authentication for different sub-domain |
|
Author |
|
leonlihkust
Joined: 13 Jun 2013 Posts: 3
|
Posted: Sun 06 Oct '13 18:20 Post subject: Authentication for different sub-domain |
|
|
I am implementing OpenERP service + Apache on Ubuntu server. The connection to the server need to be HTTPS.
Here is what I does:
a. For HTTP side, forward connection to HTTPS side.
Code: | <VirtualHost *:80>
ServerAdmin webmaster@localhost
Redirect permanent / https://www.openerp.com
|
b. For HTTPS side, set proxypass and reversepass, also authentication.
Code: | <IfModule mod_ssl.c>
<VirtualHost _default_:443>
ProxyRequests Off
SSLProxyEngine On
RequestHeader set Front-End-Https "On"
ProxyPass / http://202.181.211.123:8069/
ProxyPassReverse / http://202.181.211.123:8069/
<Location />
AuthType basic
AuthUserFile "/var/www/users/.htpasswd"
require valid-user
</location>
|
Now I want to separate sub-domains for each user, like subdomain1.openerp.com,subdomain2.openerp.com. How should I setup different password for each sub-domain?
I tried in HTTP side by set , but the "redirect" command owns higher priority than the others. What if in HTTPS side?
Thanks for your help in advance. |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7373 Location: Germany, Next to Hamburg
|
|
Back to top |
|
leonlihkust
Joined: 13 Jun 2013 Posts: 3
|
Posted: Thu 10 Oct '13 17:08 Post subject: |
|
|
Hi James, thanks for your reply.
I do have some questions.
1. For vhost case, based on following example. Does first vhost only works for ServerName customer-1.example.com and second one for ServerName customer-2.example.com respectively? Does the ServerName separate different vHost for different config or just a map between ServerName and DocumentRoot? I tried define different vHost with different ServerName for different authentication, but it seems the result is the same.
Code: | <VirtualHost 111.22.33.44>
ServerName customer-1.example.com
DocumentRoot /www/hosts/customer-1.example.com/docs
ScriptAlias /cgi-bin/ /www/hosts/customer-1.example.com/cgi-bin
</VirtualHost>
<VirtualHost 111.22.33.44>
ServerName customer-2.example.com
DocumentRoot /www/hosts/customer-2.example.com/docs
ScriptAlias /cgi-bin/ /www/hosts/customer-2.example.com/cgi-bin
</VirtualHost> |
2. For above case, it is directory-based? I mean if the source of the website is not located in assigned directory path, like /var, it would not work?
3. Is possible to implement following config:
Code: | <VirtualHost 111.22.33.44>
ServerName customer-1.example.com
Authentication 1
Redirect 1
</VirtualHost>
<VirtualHost 111.22.33.44>
ServerName customer-2.example.com
Authentication 2
Redirect 2
</VirtualHost> |
Or this way:
Code: | <VirtualHost 111.22.33.44>
if subdomain = customer-1
Authentication 1
Redirect 1
if subdomain = customer-2
Authentication 2
Redirect 2 |
Thanks a lot in advance for your help! |
|
Back to top |
|
|
|
|
|
|