Dokuwiki returning 404 file not found?

1. Output of caddy version:

v2.6.2

2. How I run Caddy:

a. System environment:

On an Arch Linux image on vultr! Using php-fpm7, no docker

b. Command:

sudo caddy reload --config /etc/caddy/Caddyfile

d. My complete Caddy config:

website.com {
	encode gzip zstd
	root * /home/a/website/wiki

	#Remember to comment the below forbidden block out when you're installing, and uncomment it when done.
	#@forbidden path /data/* /conf/* /bin/* /inc/* /install.php
	#handle @forbidden {
	#	respond * 403
	#}
	#End of the forbidden block

	try_files {path} {path}/index.html

	route {
		handle_path /_media/* {
			rewrite * /lib/exe/fetch.php?media={path}&{query}
		}
		handle_path /_detail/* {
			rewrite * /lib/exe/detail.php?media={path}&{query}
		}
		handle /_export/* {
			@export path_regexp export ^/_export/([^/]+)/(.*)
			rewrite @export /doku.php?do=export_{re.export.1}&{query}&id={re.export.2}
		}
		handle / {
			rewrite * /doku.php?{query}
		}
		try_files {path} /doku.php?id={path}&{query}
	}

	file_server
	php_fastcgi unix//run/php-fpm7/php-fpm.sock
}

# don't ask but I also need to expose a file on a very specific URL
http://www.mywebsite.com {
	root * /var/www/test
	file_server
}

3. The problem Iā€™m having:

Currently Iā€™m just trying to get my wiki to work, then eventually push it under the path of /wiki.

4. Error messages and/or full log output:

I get: File not found. when I visit the website.

Paste logs/commands/output here.
USE THE PREVIEW PANE TO MAKE SURE IT LOOKS NICELY FORMATTED.

5. What I already tried:

I followed this config file as a baseline:
https://www.dokuwiki.org/install:caddy
I have tried commenting and uncommenting the selected blocks

and I also tried messing around with file permissions:
https://dougie.io/linux/caddy-fix-file-not-found/
but still no luck!

I tried: Issues porting v1 dokuwiki config to v2 - #4 by matt
Changing unix// to unix/ which gives me a 502 instead opposed to 404

I think I fixed it by chmoding to 777 and fixing the php-fpm socket path.

:grimacing: 777 is almost never necessary, and can often lead to exploits. Instead, set proper users and groups! :100:

Agree, 777 is a bad idea.
But if 777 work, then most likely is file ownership issue.
Try to change ownership from root:wheel to www:www by command chown www:www filename the file/folder after change it back to 744.

Cheers

1 Like

This topic was automatically closed after 30 days. New replies are no longer allowed.