1. Caddy version (caddy version
):
v2.3.0 h1:fnrqJLa3G5vfxcxmOH/+kJOcunPLhSBnjgIvjXV/QTA=
2. How I run Caddy:
a. System environment:
I just downloaded phpMyAdmin-5.1.0-all-languages.zip and installed it on my VPS in /usr/share/phpMyAdmin/.
b. Command:
sudo systemctl restart caddy
c. Service/unit/compose file:
[yves@sd-163808 phpMyAdmin]$ cat /usr/lib/systemd/system/caddy.service
# caddy.service
#
# For using Caddy with a config file.
#
# Make sure the ExecStart and ExecReload commands are correct
# for your installation.
#
# See https://caddyserver.com/docs/install for instructions.
#
# WARNING: This service does not use the --resume flag, so if you
# use the API to make changes, they will be overwritten by the
# Caddyfile next time the service is restarted. If you intend to
# use Caddy's API to configure it, add the --resume flag to the
# `caddy run` command or use the caddy-api.service file instead.
[Unit]
Description=Caddy
Documentation=https://caddyserver.com/docs/
After=network.target network-online.target
Requires=network-online.target
[Service]
User=caddy
Group=caddy
ExecStart=/usr/bin/caddy run --environ --config /etc/caddy/Caddyfile
ExecReload=/usr/bin/caddy reload --config /etc/caddy/Caddyfile
TimeoutStopSec=5s
LimitNOFILE=1048576
LimitNPROC=512
PrivateTmp=true
ProtectSystem=full
AmbientCapabilities=CAP_NET_BIND_SERVICE
[Install]
WantedBy=multi-user.target
[yves@sd-163808 phpMyAdmin]$
d. My complete Caddyfile or JSON config:
[yves@sd-163808 phpMyAdmin]$ cat /etc/caddy/Caddyfile
{
debug
}
team-tabulos.com
log {
output file /var/log/caddy/access.log {
roll_keep_for 8760h
}
}
root * /opt/tabulos
php_fastcgi /phpmyadmin/* unix//run/php-fpm/www.sock {
root /usr/share/phpMyAdmin/
}
php_fastcgi unix//run/php-fpm/www.sock
file_server
[yves@sd-163808 phpMyAdmin]$
3. The problem I’m having:
I am trying to have phpmyadmin working on my machine. I though it would be a good idea to implement it as a specific route on my domain name: Bienvenue sur Tabulos for instance. So I added the following directive in my caddy file:
php_fastcgi /phpmyadmin/* unix//run/php-fpm/www.sock {
root /usr/share/phpMyAdmin/
}
Then I pointed to team-tabulos.com/phpmyadmin/index.php
from my browser, and as a result the page remains all blank. What is surprising is that I get a lot of error in the javascript console.
Actually, from what I see, I have an error for each css ressource, like this one:
Did not parse stylesheet at 'https://team-tabulos.com/phpmyadmin/themes/pmahomme/css/printview.css?v=5.1.0' because non CSS MIME types are not allowed in strict mode.
And for each javascript file, I have an error message looking like that:
Refused to execute https://team-tabulos.com/phpmyadmin/js/vendor/jquery/jquery.min.js?v=5.1.0 as script because "X-Content-Type-Options: nosniff" was given and its Content-Type is not a script MIME type.
Moreover, if I look into the response header, I can see that the Content-Type is set to:
Content-Type: text/html; charset=utf-8
for each of those two files, and for any file I am trying to look at. There’s even four files (logo images) who all four see their Content-Type
set to text/html
. So I guess that every response set its Content-Type
to text/html
.
Even though I am not a web developper, I guess it’s not the correct value… So I guess there’s an issue with the correct Content-Type
answered by Caddy. (Am I wrong or right?)
4. Error messages and/or full log output:
There’s a lot of lines in the caddy log file. If you ask for it specifically, I can make the effort to copy/paste it here. For instance for the file printview.css
, if you ask for it.
5. What I already tried:
I’ve tried to solve my issue by rewriting the Content-Type
header at the fly with some directives. I’ve wrote that in my configuration file:
header /phpmyadmin/*.js {
Content-Type 'text/javascript'
}
But it did not worked. (I think I am far from mastering the CaddyFile) How would you do to make Caddy specify the correct Content-Type
?