http://localwebsite {
# Set this path to your site's directory.
#root * /usr/share/caddy
root * /var/www/website
#makes /course/id/name.html to /course.php?id=id&name=name
@zxp {
#path_regexp myregex ^/course/(\d+)/([%A-Za-z0-9_-]+)\.html$
path_regexp myregex ^/course/([^/]+)/([^/]+)\.html$
}
rewrite @zxp /course.php?id={re.myregex.1}&name={re.myregex.2}
# rewrite /course/([^/]+)/([^/]+)\.html /course.php?id={1}&name={2}
# rewrite /course/(\d+)/([A-Za-z0-9_-]+)\.html /course.php?id=$1&name=$2
# rewrite /course/(\w+)/(\w+)\.html /course.php?id={1}&name={2}
#rewrite /course {
# r ^/(\w+)/(\w+)\.html$
# to /course.php?id={1}&name={2}
#}
# Enable the static file server.
file_server
# Another common task is to set up a reverse proxy:
# reverse_proxy localhost:8080
# Or serve a PHP site through php-fpm:
# php_fastcgi localhost:9000
php_fastcgi unix//run/php/php8.1-fpm.sock
}
Comments
Post a Comment