Hi all,
Please find below description of issue i’ve have due to incorrect/missing rewrite.
1. Caddy version (caddy version):
v2.0.0 h1:pQSaIJGFluFvu8KDGDODV8u4/QRED/OPyIR+MWYYse8=
2. How I run Caddy:
a. System environment:
Raspberry 3b+ with Raspbian + VNCServer + Syncthing + Minidlna + 2 Sata HDD + Caddy 2.0 + Gogs.
b. Command:
Caddy is start with :
caddy start -config=/home/pi/.config/caddy/Caddyfile
c. Service/unit/compose file:
d. Caddyfile:
File CaddyFile
localhost 192.168.1.26 {
root * /media/data_sata2/www
php_fastcgi unix//run/php/php7.3-fpm.sock
encode zstd gzip
file_server browse
tls internal
log {
stdout
#output file /var/log/caddy.log
}
#Added for Php
#rewrite match:indexFiles {path}/ # No redirect required
# internally rewrite directory URIs to index.php files
try_files {path} {path}/ /index.php/{uri} # Last part is the problem
# proxy any requests for PHP files to backend via FastCGI
#matcher phpFiles {
# path *.php
#}
}
3. The problem I’m having:
On localhost root, i have 2 files:
index.html which is a static page with links to different path (directories)
With Firefox
if i type
https://localhost/index.html
i see correct page.
if i type
https://localhost/index.php
i see correct page.
index.php contains only: <?php phpinfo(); ?>
If i type
localhost/[my path] /index.php
which is index.php for Wordpress
It seems i’m rerouted to localhost/index.php !
I’ve same render and not the index.php (Wordpress index.php).
If i type
localhost/[my path] /park.php
which contains static HTML page
It seems i’m rerouted to localhost/index.php !
I’ve same render and not the index.php (Wordpress index.php).
4. Error messages and/or full log output:
i’ve got no error except on all paths i go. I see the root index.php file and not the correct index.php i’ve in my path.
5. What I already tried:
i typed on browser localhost/[my path] /park.php which contains static HTML page and my browser shows me index.php render.
it seems that all path i set, i get localhost/index.php ! as i’m always redirected to localhost root.
Question:
What is correct rewrite needed to no be redirected to localhost/index.php ? because it seems to be that.
I didn’t able to look for solution.
I tested what is in this :
without success.
Thanks for your help?
Regards,
Tom