-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhamr-with-ssl.conf
58 lines (44 loc) · 1.93 KB
/
hamr-with-ssl.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# change this - path to hamr installation
<Directory "/home/dev/hamr">
Require all granted
Options +ExecCGI
AddHandler cgi-script .cgi
</Directory>
<VirtualHost *:80>
# change this - hostname for API and user apps
ServerAlias localhost *.localhost *.rajdhani.example.com
# this redirects HTTP to HTTPS
# to serve HTTP, replace this with the rewrite
# rules from the below <VirtualHost *:443>
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
DocumentRoot /var/www/html
</VirtualHost>
<VirtualHost *:443>
# change this - hostname for API and user apps
ServerAlias localhost *.localhost *.rajdhani.example.com
# change this to hamr location
Define HAMR_DIR "/home/dev/hamr"
Define PYTHON_EXE "${HAMR_DIR}/vin/bin/python"
SetEnvIf Host "^([^.]*).*$" SUBDOMAIN=$1
VirtualDocumentRoot "${HAMR_DIR}/apps/%1/site"
CustomLog "| ${PYTHON_EXE} ${HAMR_DIR}/split_logs.py ${HAMR_DIR} access" "%V %h %l %u %t \"%r\" %>s %b"
ErrorLog "| ${PYTHON_EXE} ${HAMR_DIR}/split_logs.py ${HAMR_DIR} error"
ErrorLogFormat "%V %M"
RewriteEngine On
RewriteCond "${HAMR_DIR}/apps/%{ENV:SUBDOMAIN}/site" !-d
RewriteRule ^/public/(.*)$ "${HAMR_DIR}/apps/%{ENV:SUBDOMAIN}/public/$1" [L]
RewriteCond "${HAMR_DIR}/apps/%{ENV:SUBDOMAIN}/site" !-d
RewriteRule ^(.*)$ "${HAMR_DIR}/hamr.cgi/$1" [L]
SSLEngine On
# change this - to path of the SSL certificate
SSLCertificateFile "/etc/letsencrypt/live/rajdhani.example.com/fullchain.pem"
# change this - to path of the SSL private key
SSLCertificateKeyFile "/etc/letsencrypt/live/rajdhani.example.com/privkey.pem"
</VirtualHost>
# clarifying use of subdomains:
# Here, hamr.rajdhani.example.com will be the URL for the API.
# It is reserved and apps won't be able to use the same name.
# Rest of the URLs of the form *.rajdhani.eaxmple.com will be
# used to serve the user apps.