Two different paths to a project location

1. Output of caddy version:

v2.6.2 h1:wKoFIxpmOJLGl3QXoo6PNbYvGW4xLEgo32GPBEjWL8o=

2. How I run Caddy:

a. System environment:

CentOS7

b. Command:

systemctl start caddy

c. Service/unit/compose file:

[Unit]
Description=Caddy
Documentation=https://caddyserver.com/docs/
After=network.target network-online.target
Requires=network-online.target

[Service]
Type=notify
User=caddy
Group=caddy
ExecStart=/usr/bin/caddy run --environ --config /etc/caddy/Caddyfile
ExecReload=/usr/bin/caddy reload --config /etc/caddy/Caddyfile --force
TimeoutStopSec=5s
LimitNOFILE=1048576
LimitNPROC=512
PrivateTmp=true
ProtectSystem=full
AmbientCapabilities=CAP_NET_BIND_SERVICE

[Install]
WantedBy=multi-user.target

d. My complete Caddy config:

(handle_info_log) {
	log {
		output file /var/log/caddy/info.log {
			roll_size 100MiB

			roll_keep_for 30d

		}

		format console {
			time_format wall

			time_local
		}

		level INFO
	}
}

(handle_error_log) {
	log {
		output file /var/log/caddy/error.log {
			roll_size 30MiB

			roll_keep_for 30d

		}

		format console {
			time_format wall

			time_local
		}

		level ERROR
	}
}

(handle_errors) {
	handle_errors {

	     rewrite * /{err.status_code}.html

	     file_server	

	}
}

com.exampl.cn {
	encode gzip

	import handle_errors

	import handle_info_log

	import handle_error_log

	@apk path /apk*
	file_server @apk {
		root /opt/demo-0springcloud/mobile
	}

	@ipa path /ipa*
	file_server @ipa {
		root /opt/demo-0springcloud/mobile
	}

	@videosample path /videosample*
	file_server @videosample {
		root /opt/demo-0springcloud/video
	}

3. The problem I’m having:

The different paths to a same project location, how to config? For example , path /apk route to the actual project location mobile, and the path /ipa is same as /apk .

4. Error messages and/or full log output:

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

5. What I already tried:

6. Links to relevant resources:

another solution

	handle_path /merchant/* {
		root * /opt/twomicro_v2/web/merchant

		file_server
	}

	handle_path /torna/* {
		root * /opt/twomicro_v2/web/torna

		file_server
	}

	handle_path /dingding/* {
		root * /opt/twomicro_v2/web/dingding

		file_server
	}

	handle_path /formmaking/* {
		root * /opt/twomicro_v2/web/dist

		file_server
	}

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