Last active
December 13, 2015 17:02
-
-
Save rodionbykov/ec9a8a4413ad179dcab6 to your computer and use it in GitHub Desktop.
Mura Apache VirtualHost setup
This file contains hidden or 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
<VirtualHost *:80> | |
DocumentRoot "C:/apache/htdocs/vhosts/mura" | |
ServerName mura | |
DirectoryIndex index.cfm | |
ProxyPreserveHost On | |
ProxyPassReverse / ajp://mura:8009/ | |
RewriteEngine On | |
# Done as described in http://jamiekrug.com/blog/index.cfm/2009/5/22/url-rewrite-goodies-for-apache-tomcat-railo-and-mura-cms | |
# Forbid access to Railo Admin URLs: | |
RewriteRule ^/railo-context/admin/(.*) - [F] | |
# Proxy "secret" Railo Admin URLs to "real" Railo Admin URLs on Tomcat: | |
RewriteRule ^/SOMETHING-DIFFICULT-TO-GUESS/admin/(.*\.cf[cm])$ ajp://%{HTTP_HOST}:8009/railo-context/admin/$1 [P] | |
# Uncomment the following rule if SiteID is included into URL, but index.cfm is not | |
# In /config/settings.ini.cfm, set indexfileinurls to 0 and siteidinurls to 1 to generate proper URLs in menus | |
# Don't forget to reload the Mura application and HTTP and Tomcat to make any config changes work | |
# Railo/Tomcat should be aware of this setup, as written here: http://docs.getmura.com/v6/installation-setup/how-to-add-a-servlet-mapping-for-your-siteid-to-tomcat/ | |
RewriteRule ^/([a-zA-Z0-9_-]{1,})/([a-zA-Z0-9/-]+)$ ajp://%{HTTP_HOST}:8009/$1/index.cfm/$2 [P] | |
# If it's a CFML (*.cfc or *.cfm) request, just proxy it to Tomcat: | |
RewriteRule ^(.+\.cf[cm])(/.*)?$ ajp://%{HTTP_HOST}:8009$1$2 [P] | |
# If trailing slash and real directory, then append index.cfm and proxy it to Tomcat/Railo: | |
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d | |
RewriteRule ^(.+/)$ ajp://%{HTTP_HOST}:8009%{REQUEST_URI}index.cfm [P] | |
# If it's a real file (and we haven't proxied to Tomcat, so it must be static), just serve it: | |
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f | |
RewriteRule . - [L] | |
# NOTE: Everything else must be a CMS URL path (letters/numbers/hyphens/slashes only), or a 404... | |
# Require trailing slash at this point, if otherwise valid CMS URL: | |
RewriteRule ^([a-zA-Z0-9/-]+[^/])$ $1/ [R=301,L] | |
# Valid CMS URL path is proxied to Tomcat/Railo: | |
# MUST COME AFTER ANY OTHER FIXED/EXPECTED REWRITES! | |
RewriteRule ^([a-zA-Z0-9/-]+)$ ajp://%{HTTP_HOST}:8009/index.cfm%{REQUEST_URI} [NE,P] | |
# Anything else must be a 404 error: | |
RewriteRule . ajp://%{HTTP_HOST}:8009/index.cfm/this-will-force-a-404/ [NE,P] | |
<Directory "C:/apache/htdocs/vhosts/mura"> | |
Options Indexes FollowSymLinks | |
AllowOverride All | |
Require all granted | |
</Directory> | |
</VirtualHost> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment