Tag: apache

  • Apache2 configuration for Rails

    I recently had to stand up a Rails production server that used Apache2 as a reverse proxy. While it was relatively easy proxying requests to the Thin server using ProxyPass, assets would not show up, even with a DocumentRoot specified. It seems that ProxyPass proxies all requests, and the configuration needs to specifically ignore proxying certain requests using the exclamation mark syntax. The configuration looked like:

    <VirtualHost *:80>
            ServerName example.com
            DocumentRoot /var/www/app/public
            ProxyPassMatch ^/(assets/|(404|422|500)\.html|favicon\.ico|robots\.txt) !
            ProxyPass / http://localhost:3000/
            ProxyPassReverse / http://localhost:3000/
    </VirtualHost>