rene paulokat
rene paulokat

Reputation: 302

Kemal behind apache2 with mod_proy not serving static files

I have an kemalcr based application server listening on http://127.0.0.1:3000 - behind apache2.

when running the kemalcr-app locally everything is fine and static-files - e.g. /assets/stylesheets/styles.css is delivered perfectly.

but when deploying on a production host behind apache2 - requests for the style.css will result in 404

My apache config for the virtual host looks like this:

<VirtualHost *:80>
    ServerName mydom.com
    ServerAdmin [email protected]

    ErrorLog ${APACHE_LOG_DIR}/mydom_error.log
    CustomLog ${APACHE_LOG_DIR}/mydom_access.log combined

    ProxyPass / http://127.0.0.1:3000/
    ProxyPassReverse / http://127.0.0.1:3000/
</VirtualHost>

When browsing $mydom.com kemal behind apache2 is responding fine - except for the static files.

My directory structure looks like:

app/
 - src/
 - spec/
 - public/
  - assets/
   - stylesheets/
    - styles.css

But a request for http://mydom.com/assets/stylesheets/styles.css results in 404. Any ideas?

Upvotes: 0

Views: 49

Answers (1)

rene paulokat
rene paulokat

Reputation: 302

kemal app sets app-root where it is started from:

so, a capistrano deployment uses the home-directory of deployment user - which results in

/home/deployment_user

Kemal uses per default a relative path to public_folder './public'

This results in the public folder beeing resolved to

/home/deployment_user/public 

which is - of course - not existing.

I can define the kemal-public_folder via config:

Kemal.config.public_folder = "/var/www/mydomain/current/public"

or define it according to Kemal.env e.g. 'production' or 'development'

Upvotes: 0

Related Questions