Created
June 20, 2019 19:10
-
-
Save kberov/2c3d9fc27bbdadb4676e09ae9e612a05 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/apache2/sites-enabled/001-dev.slovo.conf | |
<VirtualHost *:80> | |
ServerName dev.slovo.bg | |
ServerAdmin webmaster@dev.slovo | |
DocumentRoot /home/berov/opt/dev.slovo.bg | |
<Directory "/home/berov/opt/dev.slovo.bg"> | |
AllowOverride All | |
Require all granted | |
</Directory> | |
# LogLevel info ssl:warn | |
LogLevel info authz_core:error rewrite:debug | |
ErrorLog ${APACHE_LOG_DIR}/dev.slovo.error.log | |
CustomLog ${APACHE_LOG_DIR}/dev.slovo.access.log combined | |
</VirtualHost> | |
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet | |
#.htaccess | |
# Apache 2 .htaccess configuration for Slovo. | |
# Generated by Slovo::Command::Author::generate::a2htaccess using template a2htaccess from DATA section. | |
# Note!! If you run again `slovo generate a2htaccess` this file will NOT be | |
# rewritten. Note! Not sure if the produced .htacces will work fine for you so | |
# make sure to test locally first. | |
# Uncomment the following line when going live or regenerate slovo.cgi: | |
# slovo generate cgi_script -f slovo.cgi -m production | |
# SetEnv HTTP_MOJO_MODE production | |
# use utf-8 encoding for anything served text/plain or text/html | |
AddDefaultCharset utf-8 | |
# Protect files and directories from prying eyes. | |
<FilesMatch "(templ/|etc/|lib/|log/|t/|_build/|cover_db/|\.(pmc?|ep|conf|log|t|bak|yml|sqlite|sql)|READM.+|MANIF.+|Build.PL|Build|Makefi.+)$"> | |
#2.2 configuration: | |
<IfModule !mod_authz_core.c> | |
Order deny,allow | |
Deny from all | |
</IfModule> | |
#2.4 configuration: | |
<IfModule mod_authz_core.c> | |
Require all denied | |
</IfModule> | |
</FilesMatch> | |
Options +Indexes +FollowSymLinks +ExecCGI | |
# Requires mod_expires to be enabled. | |
<IfModule mod_expires.c> | |
# Enable expirations. | |
ExpiresActive On | |
ExpiresDefault "access plus 1 month" | |
<IfModule mod_headers.c> | |
Header append Cache-Control "public" | |
</IfModule> | |
<FilesMatch slovo.cgi> | |
# Do not allow slovo responses to be cached unless they explicitly send | |
# cache headers themselves. | |
ExpiresActive Off | |
</FilesMatch> | |
</IfModule> | |
<Files ~ "^(slovo.cgi)$"> | |
SetHandler cgi-script | |
</Files> | |
# Some more security. Redefine the mime type for the most common types of scripts | |
AddType text/plain .shtml .php .php3 .phtml .phtm .pl .py | |
<IfModule mod_rewrite.c> | |
RewriteEngine on | |
RewriteBase / | |
# Do not apply rules when requesting "favicon.ico" | |
RewriteCond %{REQUEST_FILENAME} favicon.ico [NC] | |
RewriteRule .* - [S=14] | |
# Do not apply rules when requesting "slovo.cgi" | |
RewriteCond %{SCRIPT_FILENAME} slovo.cgi [NC] | |
RewriteRule .* - [S=14] | |
# Redirect all requests for Slovo static files to respective domain's public/ directory. | |
# /css/fonts.css -> /domove/t.com/public/css/fonts.css | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond %{HTTP_HOST} ^(www|qa|dev)\.(.+)$ [NC] | |
RewriteRule ^((?:css|img|js|fonts)/.+)$ /slovo/domove/%2/public/$1 [NE,END] | |
#t.com/about-en-us.html -> t.com/domove/t.com/public/cached/about-en-us.html | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond %{HTTP_HOST} ^(www|qa|dev)\.(.+)$ [NC] | |
RewriteRule ^(.+(?!\.cgi).+\.html)$ /slovo/domove/%2/public/cached/$1 [NS,NE,END] | |
# RewriteCond %{REQUEST_FILENAME} !-f | |
# RewriteCond %{REQUEST_FILENAME} !-d | |
# RewriteRule (.+(?!\.cgi).+) /slovo/slovo.cgi/$1 [L,NE] | |
</IfModule> | |
# | |
# Make Slovo handle any 404 errors. | |
ErrorDocument 404 /slovo/slovo.cgi%{REQUEST_URI} | |
DirectoryIndex /slovo/slovo.cgi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
rewrite:trace1