| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
1
|
|
|
1
|
|
10629
|
# Apache 2 .htaccess configuration for Ado. |
|
|
1
|
|
|
1
|
|
3
|
|
|
|
1
|
|
|
|
|
11
|
|
|
|
1
|
|
|
|
|
135
|
|
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
830
|
|
|
2
|
|
|
|
|
|
|
# Generated by Ado::Command::generate::apache2htaccess using template <%= __FILE__ %>. |
|
3
|
|
|
|
|
|
|
# Note! not sure if the produced .htacces will work fine for you |
|
4
|
|
|
|
|
|
|
# so make sure to test locally first. |
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
% my $args = shift; |
|
7
|
|
|
|
|
|
|
% my $root = $args->{DocumentRoot}; |
|
8
|
|
|
|
|
|
|
% my $plackup = $args->{plackup}; |
|
9
|
|
|
|
|
|
|
% my $moniker = $args->{moniker}; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# Directives, comments and ideas in this file are taken from Drupal .htaccess, |
|
13
|
|
|
|
|
|
|
# from MYDLjE, from Contao, from TWiki, so it is hard to tell really... |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# Move the content of this file to the virtual host |
|
16
|
|
|
|
|
|
|
# configuration file for better performance if you have the right to do so. |
|
17
|
|
|
|
|
|
|
# Set some Variables for MOJO |
|
18
|
|
|
|
|
|
|
# MOJO_MODE(development|staging|production): |
|
19
|
|
|
|
|
|
|
# Uncomment the following line when going live. |
|
20
|
|
|
|
|
|
|
# SetEnv MOJO_MODE production |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# use utf-8 encoding for anything served text/plain or text/html |
|
23
|
|
|
|
|
|
|
AddDefaultCharset utf-8 |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# Support Offline Web applications |
|
26
|
|
|
|
|
|
|
AddType text/cache-manifest .appcache |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# Protect files and directories from prying eyes. |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
#2.2 configuration: |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
Order deny,allow |
|
33
|
|
|
|
|
|
|
Deny from all |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
#2.4 configuration: |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
Require all denied |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
# Don't show directory listings for URLs which map to a directory. |
|
41
|
|
|
|
|
|
|
Options -Indexes |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# Follow symbolic links in this directory. |
|
44
|
|
|
|
|
|
|
Options +FollowSymLinks |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
# Requires mod_expires to be enabled. |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
# Enable expirations. |
|
50
|
|
|
|
|
|
|
ExpiresActive On |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
ExpiresDefault "access plus 1 month" |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Header append Cache-Control "public" |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
$> |
|
57
|
|
|
|
|
|
|
# Do not allow Ado responses to be cached unless they explicitly send cache |
|
58
|
|
|
|
|
|
|
# headers themselves. |
|
59
|
|
|
|
|
|
|
ExpiresActive Off |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
#Expire manifest files immediately. |
|
63
|
|
|
|
|
|
|
ExpiresDefault "access plus 0 seconds" |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
# Additional headers for static files caching. |
|
68
|
|
|
|
|
|
|
# |
|
69
|
|
|
|
|
|
|
# |
|
70
|
|
|
|
|
|
|
# Header set Cache-Control s-maxage=2592000 "expr=%{REQUEST_STATUS} == 200" |
|
71
|
|
|
|
|
|
|
# |
|
72
|
|
|
|
|
|
|
# |
|
73
|
|
|
|
|
|
|
# Since we're sending far-future expires, we don't need ETags for |
|
74
|
|
|
|
|
|
|
# static content. |
|
75
|
|
|
|
|
|
|
# developer.yahoo.com/performance/rules.html#etags |
|
76
|
|
|
|
|
|
|
FileETag None |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
% if( grep {$_ eq 'cgi'} @{$args->{modules}} ){ |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
# Set explicitly Ado executables as cgi scripts. |
|
81
|
|
|
|
|
|
|
# Running Mojolicious apps (such as Ado) as CGI is discouraged. |
|
82
|
|
|
|
|
|
|
# However it can perfectly suit your needs if you only aim static pages generation. |
|
83
|
|
|
|
|
|
|
# See Ado::Control::Doc as an example on which you can elaborate. |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
# This is the fallback mode in case no Plack with FCGI and FCGI::ProcManager |
|
86
|
|
|
|
|
|
|
# neither Mojo::Server::FastCGI are installed. |
|
87
|
|
|
|
|
|
|
)$"> |
|
88
|
|
|
|
|
|
|
SetHandler cgi-script |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
% } |
|
92
|
|
|
|
|
|
|
% my $has_msfcgi = eval {require Mojo::Server::FastCGI}; |
|
93
|
|
|
|
|
|
|
% if(grep {$_ eq 'fcgid'} @{$args->{modules}}){ |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
# See http://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html |
|
96
|
|
|
|
|
|
|
% if(!$plackup && !$has_msfcgi) { |
|
97
|
|
|
|
|
|
|
# Sorry! no Plack with FCGI and FCGI::ProcManager neither Mojo::Server::FastCGI are installed. |
|
98
|
|
|
|
|
|
|
# Install at least one of them and rerun '<%=$moniker%> apache2htaccess'. |
|
99
|
|
|
|
|
|
|
% } |
|
100
|
|
|
|
|
|
|
% else { |
|
101
|
|
|
|
|
|
|
)$"> |
|
102
|
|
|
|
|
|
|
SetHandler fcgid-script |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
% } |
|
105
|
|
|
|
|
|
|
% if($plackup){ |
|
106
|
|
|
|
|
|
|
# plackup must be run with the same perl as <%=$moniker%> |
|
107
|
|
|
|
|
|
|
% my $sock = File::Spec->catfile(File::Spec->tmpdir(), $moniker.time().$$.'.sock'); |
|
108
|
|
|
|
|
|
|
% $sock =~ s|\\|/|g; |
|
109
|
|
|
|
|
|
|
# Using Plack with FCGI and FCGI::ProcManager |
|
110
|
|
|
|
|
|
|
FcgidWrapper "<%= "$plackup $root/bin/$moniker -s FCGI -l $sock" %>" |
|
111
|
|
|
|
|
|
|
% } |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
% if($has_msfcgi){ |
|
114
|
|
|
|
|
|
|
# Use your own perl. You may need to fix paths if they contain spaces. |
|
115
|
|
|
|
|
|
|
# Using Mojo::Server::FastCGI. |
|
116
|
|
|
|
|
|
|
# Uncomment the following (and comment any previous "FcgidWrapper") |
|
117
|
|
|
|
|
|
|
# if you prefer Mojo::Server::FastCGI. |
|
118
|
|
|
|
|
|
|
<%= $plackup? '#':''%> FcgidWrapper "<%= "$args->{perl} $root/bin/$moniker" %> fastcgi" |
|
119
|
|
|
|
|
|
|
% } |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
% } |
|
122
|
|
|
|
|
|
|
# Make Ado handle any 404 errors. |
|
123
|
|
|
|
|
|
|
ErrorDocument 404 /bin/<%=$moniker%> |
|
124
|
|
|
|
|
|
|
DirectoryIndex /bin/<%=$moniker%> |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
#Some more security. Redefine the mime type for the most common types of scripts |
|
127
|
|
|
|
|
|
|
AddType text/plain .shtml .php .php3 .phtml .phtm .pl .py .cgi |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
# Various rewrite rules. |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
RewriteEngine on |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
# Set "protossl" to "s" if we were accessed via https://. This is used later |
|
134
|
|
|
|
|
|
|
# if you enable "www." stripping or enforcement, in order to ensure that |
|
135
|
|
|
|
|
|
|
# you don't bounce between http and https. |
|
136
|
|
|
|
|
|
|
# RewriteRule ^ - [E=protossl] |
|
137
|
|
|
|
|
|
|
# RewriteCond %{HTTPS} on |
|
138
|
|
|
|
|
|
|
# RewriteRule ^ - [E=protossl:s] |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
# Make sure Authorization HTTP header is available to Ado |
|
141
|
|
|
|
|
|
|
# even when running as CGI or FastCGI. |
|
142
|
|
|
|
|
|
|
# RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
# Block access to "hidden" directories whose names begin with a period. |
|
145
|
|
|
|
|
|
|
# RewriteRule "(^|/)\." - [F] |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
# To redirect all users to access the site WITH the 'www.' prefix, |
|
148
|
|
|
|
|
|
|
# (http://example.com/... will be redirected to http://www.example.com/...) |
|
149
|
|
|
|
|
|
|
# uncomment the following: |
|
150
|
|
|
|
|
|
|
# RewriteCond %{HTTP_HOST} . |
|
151
|
|
|
|
|
|
|
# RewriteCond %{HTTP_HOST} !^www\. [NC] |
|
152
|
|
|
|
|
|
|
# RewriteRule ^ http%{ENV:protossl}://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] |
|
153
|
|
|
|
|
|
|
# |
|
154
|
|
|
|
|
|
|
# To redirect all users to access the site WITHOUT the 'www.' prefix, |
|
155
|
|
|
|
|
|
|
# (http://www.example.com/... will be redirected to http://example.com/...) |
|
156
|
|
|
|
|
|
|
# uncomment the following: |
|
157
|
|
|
|
|
|
|
# RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] |
|
158
|
|
|
|
|
|
|
# RewriteRule ^ http%{ENV:protossl}://%1%{REQUEST_URI} [L,R=301] |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
# If your site is running in a VirtualDocumentRoot at http://example.com/, |
|
161
|
|
|
|
|
|
|
# use the following line: |
|
162
|
|
|
|
|
|
|
# RewriteBase / |
|
163
|
|
|
|
|
|
|
# Otherwise set RewriteBase to the subdirectory where your site is, e.g. /<%=$moniker%>. |
|
164
|
|
|
|
|
|
|
# RewriteBase /<%=$moniker%> |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
# Redirect all requests for Ado static files to public/ directory. |
|
167
|
|
|
|
|
|
|
RewriteCond %{REQUEST_FILENAME} !-f |
|
168
|
|
|
|
|
|
|
RewriteCond %{REQUEST_FILENAME} !-d |
|
169
|
|
|
|
|
|
|
RewriteRule ^((css|doc|fonts|img|js|vendor|favicon|index)\b.*)$ /public/$1 [L] |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
RewriteCond %{REQUEST_FILENAME} !-f |
|
173
|
|
|
|
|
|
|
RewriteCond %{REQUEST_FILENAME} !-d |
|
174
|
|
|
|
|
|
|
RewriteRule (.*) /bin/<%=$moniker%>/$1 [L] |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
|