Css/js files not accessable

Hello, I might have a configuration error in production setup. But I don’t know which one.

Problem: CSS/JS etc files are not loaded. When I click them in source-viewer (browser), cake says, that the controller is missing (e.g. CssController). But I clicked a css-file.

I think, I have the correct .htaccess-files and vhost.conf.

Filesystem: /var/www/html (user/group = www-data)
a2enmod rewrite (mod rewrite is active)

Document-Root: /var/www/html
Webroot: /var/www/html/webroot.

<VirtualHost *:81>
DocumentRoot /var/www/html/webroot
Servername site.localhost

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

<Directory /var/www/html/webroot>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order Allow,Deny
Allow from all

.htaccess of DocumentRoot

RewriteEngine on
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]

.htaccess of Webroot

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

Please help me. I don’t know why this is happening. Developing on windows using theses htaccess, everything is working fine.

Deploying this packet on CentOS is working fine.

Just copied this to another machine (docker machine), this error comes up. Maybe sth. with apache or nginx wrong. (nginx is only a reverse proxy getting data from apache).



Sorry for pushing/bumping. This problem still exists. I just don’t get what’s wrong there.

Hope anybody can help me.

Thanks in advance!

What do you get in the apache access log ? Might be a permission story.

Hello and sorry - I didn’t recognize the notification eMail so I missed your answer.

I could solve the problem. I had the wrong DocumentRoot caused by another nginx-Directive. It was pretty hard to debug because I was dockerizing my stack.

But thanks anyway!