Note that there are some explanatory texts on larger screens.

plurals
  1. POApache: Deliver some urls from the file system, all others from Rails app
    primarykey
    data
    text
    <p>I want to host two different services on a Apache web server, reachable via the same domain: Some special URLs should go into the filesystem, all others should be handle by a Rails application.</p> <p>Example:</p> <pre><code>http://mydomain.com/foo/123.txt =&gt; should deliver /var/www/special/foo/123.txt http://mydomain.com/users =&gt; should go to Rails/Passenger </code></pre> <p>Here is my virtual host setup for the Rails app:</p> <pre><code>&lt;VirtualHost *:80&gt; ServerName mydomain.com ServerAlias *.mydomain.com DocumentRoot /var/www/mydomain/current/public &lt;Directory /var/www/mydomain/current/public&gt; Options FollowSymLinks AllowOverride None Order allow,deny Allow from all ExpiresActive on ExpiresDefault "access plus 1 year" FileETag MTime Size &lt;/Directory&gt; RewriteEngine On # Check for maintenance file and redirect all requests ErrorDocument 503 /system/maintenance.html RewriteCond %{REQUEST_URI} !\.(css|gif|jpg|png)$ RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f RewriteCond %{SCRIPT_FILENAME} !maintenance.html RewriteRule ^.*$ - [redirect=503,last] # Rewrite index to check for static RewriteRule ^/$ /index.html [QSA] # Rewrite to check for Rails cached page RewriteRule ^([^.]+)$ $1.html [QSA] # Deflate AddOutputFilterByType DEFLATE text/html text/plain text/css text/xml application/xml application/xhtml+xml text/javascript application/x-javascript BrowserMatch ^Mozilla/4 gzip-only-text/html BrowserMatch ^Mozilla/4.0[678] no-gzip BrowserMatch \bMSIE !no-gzip !gzip-only-text/html ErrorLog /var/log/apache2/mydomain.com-error_log CustomLog /var/log/apache2/mydomain.com-access_log combined &lt;/VirtualHost&gt; </code></pre> <p>Somewhere in the middle a RewriteCond/RewiteRule should be added, so accessing <a href="http://mydomain.com/foo/123.txt" rel="nofollow noreferrer">http://mydomain.com/foo/123.txt</a> does not go to the Rails app, but the filesystem instead.</p> <p>For this I need help. It would by great if someone can can give me a hint.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload