This configuration used Apache Mongrel Proxy to redirect the TWO subdomains:
team.domain.com to https://www.domain.com/myteam/Team.html
and
teamadmin.domain.com to https://www.domain.com/myteam/TeamAdmin.html
1.) First you need to edit /etc/httpd/conf/httpd.conf file (i.e., sudo nano /etc/httpd/conf/httpd.conf) and enter the following lines just before the line, ”# UserDir: The name of the directory that is appended onto a user's home...”:
<Directory "/var/www/vhosts/team.domain.com">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
<Directory "/var/www/vhosts/teamadmin.domain.com">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
and right after the line, “include /etc/httpd/conf/test/*.conf,” (Note that the TEST directory in /etc/httpd/conf/test/*.conf file is the directory which your DOMAIN configuration file is located).
Then add the following lines:
<VirtualHost *:80>
ServerAdmin myemailaddress@gmail.com
DocumentRoot /var/www/vhosts/team.domain.com
ServerName team.domain.com
ErrorLog logs/team.domain.com-error_log
CustomLog logs/team.domain.com-access_log common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin myemailaddress@gmail.com
DocumentRoot /var/www/vhosts/teamadmin.domain.com
ServerName teamadmin.domain.com
ErrorLog logs/teamadmin.domain.com-error_log
CustomLog logs/teamadmin.domain.com-access_log common
</VirtualHost>
2.) Create the directories /var/www/vhosts/team.domain.com (i.e., mkdir -p
/var/www/vhosts/team.domain.com) and /var/www/vhosts/teamadmin.domain.com (i.e., mkdir -p /var/www/vhosts/teamadmin.domain.com).
3.) Create the files /var/www/vhosts/team.domain.com/.htaccess (i.e., sudo nano
/var/www/vhosts/team.domain.com/.htaccess) with the following entry:
RewriteEngine on
RewriteRule ^(.*)$ https://www.domain.com/myteam/Team.html
and /var/www/vhosts/teamadmin.domain.com/.htaccess (i.e., sudo nano
/var/www/vhosts/teamadmin.domain.com/.htaccess) with the following entry:
RewriteEngine on
RewriteRule ^(.*)$ https://www.domain.com/myteam/TeamAdmin.html
(Note that the https://www.domain.com/myteam/Team.html and https://www.domain.com/myteam/TeamAdmin.html, is just an example for this tutorials).
4.) Since I used Apache Mongrel Proxy, then we have to edit /etc/httpd/conf/team/mongrel_proxy.conf file (i.e., sudo nano
/etc/httpd/conf/team/mongrel_proxy.conf) and enter the following lines right after the
line, “RewriteRule . /system/maintenance.html [L]”:
RewriteCond %{HTTPS} off
RewriteRule . https://%{HTTP_HOST}%{REQUEST_URI}
The above lines insure that everything will be accessed via https (forcibly)!
5. For the installation of SSL certificates obtained from your domain registrar like GoDaddy, refer to the following documents:
6. Finally, restart the Apache httpd web server (i.e., sudo /etc/rc.d/init.d/httpd restart).
Excellent post I must say..Extremely helpful information.
ReplyDelete