Ado

 view release on metacpan or  search on metacpan

templates/partials/apache2htaccess.ep  view on Meta::CPAN

    #Expire manifest files immediately.
    ExpiresDefault "access plus 0 seconds"
  </FilesMatch>
</IfModule>

# Additional headers for static files caching.
#<IfModule mod_headers.c>
#  <FilesMatch "\.(txt|js|css|htc|png|gif|jpe?g|ico|xml|csv|txt|swf|flv|mp4|webm|ogv|mp3|ogg|oga|eot|woff|svg|svgz|ttf|pdf|gz)$">
#    Header set Cache-Control s-maxage=2592000 "expr=%{REQUEST_STATUS} == 200"
#  </FilesMatch>
#</IfModule>
# Since we're sending far-future expires, we don't need ETags for
# static content.
# developer.yahoo.com/performance/rules.html#etags
FileETag None

% if( grep {$_ eq 'cgi'} @{$args->{modules}} ){
<IfModule mod_cgi.c>
  # Set explicitly Ado executables as cgi scripts.
  # Running Mojolicious apps (such as Ado) as CGI is discouraged.
  # However it can perfectly suit your needs if you only aim static pages generation.
  # See Ado::Control::Doc as an example on which you can elaborate.

  # This is the fallback mode in case no Plack with FCGI and FCGI::ProcManager 
  # neither Mojo::Server::FastCGI are installed.
  <Files ~ "^(<%=$moniker%>)$">
    SetHandler  cgi-script
  </Files>
</IfModule>
% }
% my $has_msfcgi = eval {require Mojo::Server::FastCGI};
% if(grep {$_ eq 'fcgid'} @{$args->{modules}}){
<IfModule mod_fcgid.c>
  # See http://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html
  % if(!$plackup && !$has_msfcgi) {
    # Sorry! no Plack with FCGI and FCGI::ProcManager neither Mojo::Server::FastCGI are installed.
    # Install at least one of them and rerun '<%=$moniker%> apache2htaccess'.
  % }
  % else {
  <Files ~ "^(<%=$moniker%>)$">
    SetHandler  fcgid-script
  </Files>
  % }
  % if($plackup){
    # plackup must be run with the same perl as <%=$moniker%>
    % my $sock = File::Spec->catfile(File::Spec->tmpdir(), $moniker.time().$$.'.sock');
    % $sock =~ s|\\|/|g;
    # Using Plack with FCGI and FCGI::ProcManager
    FcgidWrapper "<%= "$plackup $root/bin/$moniker -s FCGI -l $sock" %>"
  % }

  % if($has_msfcgi){
    # Use your own perl. You may need to fix paths if they contain spaces.
    # Using Mojo::Server::FastCGI. 
    # Uncomment the following (and comment any previous "FcgidWrapper")
    # if you prefer Mojo::Server::FastCGI.
    <%= $plackup? '#':''%> FcgidWrapper "<%= "$args->{perl} $root/bin/$moniker" %> fastcgi"
  % }
</IfModule>
% }
# Make Ado handle any 404 errors.
ErrorDocument 404 /bin/<%=$moniker%>
DirectoryIndex /bin/<%=$moniker%>

#Some more security. Redefine the mime type for the most common types of scripts
AddType text/plain .shtml .php .php3 .phtml .phtm .pl .py .cgi

# Various rewrite rules.
<IfModule mod_rewrite.c>
  RewriteEngine on

  # Set "protossl" to "s" if we were accessed via https://.  This is used later
  # if you enable "www." stripping or enforcement, in order to ensure that
  # you don't bounce between http and https.
  # RewriteRule ^ - [E=protossl]
  # RewriteCond %{HTTPS} on
  # RewriteRule ^ - [E=protossl:s]

  # Make sure Authorization HTTP header is available to Ado
  # even when running as CGI or FastCGI.
  # RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

  # Block access to "hidden" directories whose names begin with a period.
  # RewriteRule "(^|/)\." - [F]

  # To redirect all users to access the site WITH the 'www.' prefix,
  # (http://example.com/... will be redirected to http://www.example.com/...)
  # uncomment the following:
  # RewriteCond %{HTTP_HOST} .
  # RewriteCond %{HTTP_HOST} !^www\. [NC]
  # RewriteRule ^ http%{ENV:protossl}://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  #
  # To redirect all users to access the site WITHOUT the 'www.' prefix,
  # (http://www.example.com/... will be redirected to http://example.com/...)
  # uncomment the following:
  # RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
  # RewriteRule ^ http%{ENV:protossl}://%1%{REQUEST_URI} [L,R=301]

  # If your site is running in a VirtualDocumentRoot at http://example.com/,
  # use the following line:
  # RewriteBase /
  # Otherwise set RewriteBase to the subdirectory where your site is, e.g. /<%=$moniker%>.
  # RewriteBase /<%=$moniker%>

  # Redirect all requests for Ado static files to public/ directory.
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^((css|doc|fonts|img|js|vendor|favicon|index)\b.*)$  /public/$1 [L]


  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule (.*) /bin/<%=$moniker%>/$1 [L]

</IfModule>



( run in 0.890 second using v1.01-cache-2.11-cpan-39bf76dae61 )