Virtual Host And Certbot in RHEL7
httpd.conf
vim /etc/httpd/conf/httpd.conf
# ServerAdmin: Your address, where problems with the server should be
# e-mailed. This address appears on some server-generated pages, such
# as error documents. e.g. [email protected]
#
ServerAdmin [email protected]
# Supplemental configuration
#
# Load config files in the "/etc/httpd/conf.d" directory, if any.
IncludeOptional conf.d/*.conf
IncludeOptional /ihe/etc/httpd/conf.sites.d/*.conf
ServerName 100.43.10.200
# mkdir -p /etc/httpd/conf.sites.d/
# mkdir -p /var/www/
# create folder inside /ihe mount point
mkdir -p /ihe/etc/httpd/conf.sites.d/
mkdir -p /ihe/var/www
|
cd /ihe/var/www/;\
p='api cdn dev hl7';\
for s in $p;\
do d='html docs soft';for f in $d;\
do mkdir -p "$s.medisys.com.my/$f";\
done;
done
|
cd /ihe/var/www/;\
p='api cdn dev hl7';\
for s in $p;\
do d='html docs soft';for f in $d;\
do mkdir -p "$s.rufaida.com.my/$f";\
done;
done
|
;vim /ihe/var/www/api.medisys.com.my/html/.htaccess
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteCond %{SERVER_NAME} =api.medisys.com.my [OR]
RewriteCond %{SERVER_NAME} =www.api.medisys.com.my
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
f='html docs soft';\
for s in *.medisys.com.my;do for d in $f;do \
h="<html>\n<head><title>$s/$d</title></head>\n";
h="$h<body><h1>Welcome to, $s/$d</h1></body>\n</html>";
echo -e "$h" >> "$s/$d/index.html";
done;done
|
f='html docs soft';\
for s in *.rufaida.com.my;do for d in $f;do \
h="<html>\n<head><title>$s/$d</title></head>\n";
h="$h<body><h1>Welcome to, $s/$d</h1></body>\n</html>";
echo -e "$h" >> "$s/$d/index.html";
done;done
|
HTTP
api.medisys.com.my.conf
vim /etc/httpd/conf.sites.d/01-api.medisys.com.my.conf
<VirtualHost *:80>
ProxyRequests Off
ProxyPreserveHost On
AllowEncodedSlashes Off
ServerAlias api.medisys.com.my
ServerAdmin [email protected]
ServerName www.api.medisys.com.my
DocumentRoot /ihe/var/www/api.medisys.com.my/html
ErrorLog /ihe/var/www/api.medisys.com.my/error.log
CustomLog /ihe/var/www/api.medisys.com.my/requests.log combined
<Directory "/ihe/var/www/api.medisys.com.my/">
AllowOverride None
Require all granted
</Directory>
<Directory "/ihe/var/www/api.medisys.com.my/html">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
Order allow,deny
Allow from all
</Directory>
# proxy for forms
<Location /forms>
Order Allow,Deny
Allow from all
ProxyPass http://175.144.214.83:9001/forms nocanon
ProxyPassReverse http://175.144.214.83:9001/forms
</Location>
#RewriteEngine on
#RewriteCond %{SERVER_NAME} =api.medisys.com.my [OR]
#RewriteCond %{SERVER_NAME} =www.api.medisys.com.my
#RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
api.rufaida.com.my.conf
vim /etc/httpd/conf.sites.d/01-api.rufaida.com.my.conf
<VirtualHost *:80>
ProxyRequests Off
ProxyPreserveHost On
AllowEncodedSlashes Off
ServerAlias api.rufaida.com.my
ServerAdmin [email protected]
ServerName www.api.rufaia.com.my
DocumentRoot /ihe/var/www/api.rufaida.com.my/html
ErrorLog /ihe/var/www/api.rufaida.com.my/error.log
CustomLog /ihe/var/www/api.rufaida.com.my/requests.log combined
<Directory "/ihe/var/www/api.rufaida.com.my/">
AllowOverride None
Require all granted
</Directory>
<Directory "/ihe/var/www/api.rufaida.com.my/html">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
Order allow,deny
Allow from all
</Directory>
# proxy for forms
<Location /forms>
Order Allow,Deny
Allow from all
ProxyPass http://202.40.189.18:9001/forms nocanon
ProxyPassReverse http://202.40.189.18:9001/forms
</Location>
#RewriteEngine on
#RewriteCond %{SERVER_NAME} =www.api.rufaia.com.my [OR]
#RewriteCond %{SERVER_NAME} =api.rufaida.com.my
#RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
cdn.medisys.com.my.conf
vim /etc/httpd/conf.sites.d/00-cdn.rufaida.com.my.conf
<VirtualHost *:80>
ProxyRequests Off
ProxyPreserveHost On
AllowEncodedSlashes Off
ServerAlias cdn.medisys.com.my
ServerAdmin [email protected]
ServerName www.cdn.medisys.com.my
DocumentRoot /ihe/var/www/cdn.medisys.com.my/html
ErrorLog /ihe/var/www/cdn.medisys.com.my/error.log
CustomLog /ihe/var/www/cdn.medisys.com.my/requests.log combined
<Directory "/ihe/var/www/cdn.medisys.com.my/">
AllowOverride None
Require all granted
</Directory>
<Directory "/ihe/var/www/cdn.medisys.com.my/html">
Options Indexes FollowSymLinks
AllowOverride ALL
Require all granted
Order allow,deny
Allow from all
</Directory>
RewriteEngine on
RewriteCond %{HTTP_HOST} =175.144.214.82 [OR]
RewriteCond %{HTTP_HOST} =100.43.10.200
RewriteRule ^ https://cdn.medisys.com.my%{REQUEST_URI} [END,NE,R=permanent]
#RewriteCond %{SERVER_NAME} =cdn.medisys.com.my [OR]
#RewriteCond %{SERVER_NAME} =www.cdn.medisys.com.my
#RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
dev.medisys.com.my.conf
vim /etc/httpd/conf.sites.d/00-dev.rufaida.com.my.conf
<VirtualHost *:80>
ProxyRequests Off
ProxyPreserveHost On
AllowEncodedSlashes Off
ServerAlias dev.medisys.com.my
ServerAdmin [email protected]
ServerName www.dev.medisys.com.my
DocumentRoot /ihe/var/www/dev.medisys.com.my/html
ErrorLog /ihe/var/www/dev.medisys.com.my/error.log
CustomLog /ihe/var/www/dev.medisys.com.my/requests.log combined
<Directory "/ihe/var/www/dev.medisys.com.my/">
AllowOverride None
Require all granted
</Directory>
<Directory "/ihe/var/www/dev.medisys.com.my/html">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
Order allow,deny
Allow from all
</Directory>
#RewriteEngine on
#RewriteCond %{SERVER_NAME} =dev.medisys.com.my [OR]
#RewriteCond %{SERVER_NAME} =www.dev.medisys.com.my
#RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
hl7.medisys.com.my.conf
vim /etc/httpd/conf.sites.d/00-hl7.rufaida.com.my.conf
<VirtualHost *:80>
ProxyRequests Off
ProxyPreserveHost On
AllowEncodedSlashes Off
ServerAlias hl7.medisys.com.my
ServerAdmin [email protected]
ServerName www.hl7.medisys.com.my
DocumentRoot /ihe/var/www/hl7.medisys.com.my/html
ErrorLog /ihe/var/www/hl7.medisys.com.my/error.log
CustomLog /ihe/var/www/hl7.medisys.com.my/requests.log combined
<Directory "/ihe/var/www/hl7.medisys.com.my/">
AllowOverride None
Require all granted
</Directory>
<Directory "/ihe/var/www/hl7.medisys.com.my/html">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
Order allow,deny
Allow from all
</Directory>
#RewriteEngine on
#RewriteCond %{SERVER_NAME} =www.hl7.medisys.com.my [OR]
#RewriteCond %{SERVER_NAME} =hl7.medisys.com.my
#RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>