|
| 1 | +# |
| 2 | +# pub.openthc |
| 3 | +# |
| 4 | + |
| 5 | +Define "pub_host" "pub.openthc.example.com" |
| 6 | +Define "pub_root" "/opt/openthc/pub" |
| 7 | + |
| 8 | + |
| 9 | +# webroot |
| 10 | +<Directory ${pub_root}/webroot> |
| 11 | + |
| 12 | + <LimitExcept GET HEAD POST> |
| 13 | + Require all denied |
| 14 | + </LimitExcept> |
| 15 | + |
| 16 | + AllowOverride None |
| 17 | + Options FollowSymLinks Indexes |
| 18 | + Require all granted |
| 19 | + |
| 20 | + # Headers |
| 21 | + Header set referrer-policy "same-origin" |
| 22 | + Header set x-content-type-options "nosniff" |
| 23 | + Header set x-frame-options "deny" |
| 24 | + Header set x-xss-protection "1; mode=block" |
| 25 | + |
| 26 | + # Main Controller |
| 27 | + RewriteEngine On |
| 28 | + RewriteCond %{REQUEST_FILENAME} !-d |
| 29 | + RewriteCond %{REQUEST_FILENAME} !-f |
| 30 | + RewriteRule .* /main.php [L,QSA] |
| 31 | + |
| 32 | + # PHP Settings |
| 33 | + php_flag allow_url_fopen off |
| 34 | + php_flag allow_url_include off |
| 35 | + php_flag define_syslog_variables on |
| 36 | + php_flag display_errors on |
| 37 | + php_flag display_startup_errors on |
| 38 | + php_flag enable_dl off |
| 39 | + php_flag error_log on |
| 40 | + php_flag expose_php off |
| 41 | + php_flag html_errors off |
| 42 | + php_flag ignore_repeated_errors on |
| 43 | + php_flag ignore_repeated_source on |
| 44 | + php_flag implicit_flush off |
| 45 | + php_flag log_errors on |
| 46 | + php_flag magic_quotes_runtime off |
| 47 | + php_flag mail.add_x_header off |
| 48 | + |
| 49 | + php_value date.timezone UTC |
| 50 | + php_value error_reporting -1 |
| 51 | + php_value max_input_vars 64 |
| 52 | + php_value memory_limit 256M |
| 53 | + php_value post_max_size 12M |
| 54 | + php_value upload_max_filesize 12M |
| 55 | + |
| 56 | + # Session Data |
| 57 | + php_flag session.auto_start off |
| 58 | + php_flag session.cookie_httponly on |
| 59 | + php_flag session.cookie_secure on |
| 60 | + php_flag session.use_strict_mode on |
| 61 | + php_value session.cookie_lifetime 0 |
| 62 | + php_value session.cookie_samesite strict |
| 63 | + php_value session.gc_maxlifetime 3600 |
| 64 | + php_value session.name openthc |
| 65 | + |
| 66 | +</Directory> |
| 67 | + |
| 68 | + |
| 69 | +# |
| 70 | +# HTTP |
| 71 | +<VirtualHost *:80> |
| 72 | + |
| 73 | + DocumentRoot ${pub_root}/webroot |
| 74 | + |
| 75 | + ServerName ${pub_host} |
| 76 | + |
| 77 | + RewriteEngine On |
| 78 | + RewriteCond %{HTTPS} !=on |
| 79 | + RewriteRule ^/.well-known - [END] |
| 80 | + RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L] |
| 81 | + |
| 82 | +</VirtualHost> |
| 83 | + |
| 84 | + |
| 85 | +# |
| 86 | +# HTTPS |
| 87 | +<VirtualHost *:443> |
| 88 | + |
| 89 | + DocumentRoot ${pub_root}/webroot |
| 90 | + |
| 91 | + ServerName ${pub_host} |
| 92 | + |
| 93 | + SSLEngine On |
| 94 | + SSLCertificateFile /etc/letsencrypt/live/${pub_host}/fullchain.pem |
| 95 | + SSLCertificateKeyFile /etc/letsencrypt/live/${pub_host}/privkey.pem |
| 96 | + |
| 97 | + SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1 |
| 98 | + |
| 99 | +</VirtualHost> |
0 commit comments