Ado

 view release on metacpan or  search on metacpan

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

# Apache 2 .htaccess configuration for Ado.
# Generated by Ado::Command::generate::apache2htaccess using template <%= __FILE__ %>.
# Note! not sure if the produced .htacces will work fine for you
# so make sure to test locally first.

% my $args = shift;
% my $root = $args->{DocumentRoot};
% my $plackup = $args->{plackup};
% my $moniker = $args->{moniker};


# Directives, comments and ideas in this file are taken from Drupal .htaccess,
# from MYDLjE, from Contao, from TWiki, so it is hard to tell really...

# Move the content of this file to the virtual host
# configuration file for better performance if you have the right to do so.
# Set some Variables for MOJO
# MOJO_MODE(development|staging|production):
# Uncomment the following line when going live.
# SetEnv MOJO_MODE production

# use utf-8 encoding for anything served text/plain or text/html
AddDefaultCharset utf-8

# Support Offline Web applications
AddType text/cache-manifest .appcache

# Protect files and directories from prying eyes.
<FilesMatch "(templates/|etc/|lib/|log/|t/|_build/|cover_db/|\.(pm|ep|conf|log|t|bak|yml|sqlite|sql)|READM.*|MANIFES.*|Build.PL|Build)$">
    #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>
# Don't show directory listings for URLs which map to a directory.
Options -Indexes

# Follow symbolic links in this directory.
Options +FollowSymLinks


# 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 <%=$moniker%>$>
    # Do not allow Ado responses to be cached unless they explicitly send cache
    # headers themselves.
    ExpiresActive Off
  </FilesMatch>
  <FilesMatch "\.(appcache)$">
    #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 {



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