On latest bookworm image
We are running an admin dashboard build with vuejs. On the same apache server as cockpit. Just on an Alt port. Http://xxx.xxx.xx.xx:8080
The problem is very simple to explain.
When I refresh the browser on this page, it works fine.
Http://xxx.xxx.xx.xx:8080
When I refresh the browser on any other page, it doesn't work and I get a 404 error.
Http://xxx.xxx.xx.xx:8080/settings
We try a lot of different things in apache conf, .htaccess.....
Nothing make the trick.
We use the exacte same setup deploy on a raspberry. Work just fine ...
Could it be possible to be a kunbus cockpit config conflict somehow. Any hints is more than welcome
404 error on the apache server
Re: 404 error on the apache server
Hi,
please share the configuration you did try.
Nicolai
please share the configuration you did try.
Nicolai
Re: 404 error on the apache server
the dist folder where the vue site is deploy :
"/var/www/html/keasy/"
the .htaccess in this folder
"/etc/apache2/sites-enabled/keasy.conf"
"/var/www/html/keasy/"
the .htaccess in this folder
Code: Select all
# Activer le moteur de réécriture
RewriteEngine On
# Gérer les requêtes pour les fichiers et répertoires existants
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rediriger toutes les autres requêtes vers index.html
RewriteRule ^ index.html [L]
# Désactiver la mise en cache pour les fichiers HTML
<FilesMatch "\.html$">
Header set Cache-Control "no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires 0
</FilesMatch>
# Activer la mise en cache pour les ressources statiques
<FilesMatch "\.(css|js|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$">
Header set Cache-Control "max-age=31536000, public"
</FilesMatch>
"/etc/apache2/sites-enabled/keasy.conf"
Code: Select all
# apache2 virtual host configuration for keasy.local
# This file should be placed in /etc/apache2/sites-available/keasy.conf
# and symlinked to /etc/apache2/sites-enabled/keasy.conf
Listen 8080
<VirtualHost *:8080>
ServerName keasy.local
DocumentRoot /var/www/html/keasy
<Directory /var/www/html/keasy>
Options -Indexes +FollowSymLinks
AllowOverride All
Require all granted
# Regles de reecriture pour SPA
RewriteEngine On
# Si le fichier demande n'existe pas physiquement
RewriteCond %{REQUEST_FILENAME} !-f
# Si le repertoire demande n'existe pas
RewriteCond %{REQUEST_FILENAME} !-d
# Redirige toutes les requetes vers index.html
RewriteRule ^ index.html [L]
</Directory>
ErrorLog ${APACHE_LOG_DIR}/keasy_error.log
CustomLog ${APACHE_LOG_DIR}/keasy_access.log combined
</VirtualHost>
Last edited by Fabien on 30 Apr 2025, 10:36, edited 1 time in total.
Re: 404 error on the apache server
Move the rewrite block in your apache config outside of the Directory:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ /index.html [L]
</IfModule>
Also the .htaccess is redundant and not working unless you specifically allow it with something like
<Directory /var/www/html/keasy>
AllowOverride all
Require all granted
</Directory>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ /index.html [L]
</IfModule>
Also the .htaccess is redundant and not working unless you specifically allow it with something like
<Directory /var/www/html/keasy>
AllowOverride all
Require all granted
</Directory>