246 lines
7.9 KiB
Plaintext
246 lines
7.9 KiB
Plaintext
--- caddy.conf.example.orig 2026-09-03 04:34:07 UTC
|
|
+++ caddy.conf.example
|
|
@@ -1,12 +1,13 @@
|
|
# Caddy configuration for Poweradmin
|
|
-# This configuration is used in the production Docker image and provides
|
|
-# comprehensive security, API support, and performance optimizations.
|
|
+# This configuration provides comprehensive security, API support, and
|
|
+# performance optimizations.
|
|
#
|
|
# Usage:
|
|
-# 1. Copy this file to your desired location (e.g., /etc/caddy/Caddyfile)
|
|
+# 1. Copy this file to your desired location (%%PREFIX%%/etc/caddy/Caddyfile)
|
|
# 2. Adjust the following settings for your environment:
|
|
# - server_name: Set to your domain name (replace :80 with your-domain.com)
|
|
-# - root: Set to your Poweradmin installation path (default: /srv/www)
|
|
+# - root: Set to your Poweradmin installation path (default:
|
|
+# %%WWWDIR%%)
|
|
# - php_fastcgi: Adjust PHP-FPM socket/TCP configuration as needed
|
|
#
|
|
# For HTTPS, replace :80 with your domain name and Caddy will automatically
|
|
@@ -20,91 +21,91 @@
|
|
# ROOT FOLDER DEPLOYMENT (Default)
|
|
# ============================================================================
|
|
:80 {
|
|
- # Set this path to your Poweradmin installation directory
|
|
- root * /srv/www
|
|
+ # Set this path to your Poweradmin installation directory
|
|
+ root * %%WWWDIR%%
|
|
|
|
- # Enable access logs
|
|
- log {
|
|
- output file /var/log/caddy/poweradmin.log {
|
|
- roll_size 100mb
|
|
- roll_keep 5
|
|
- roll_keep_for 720h
|
|
- }
|
|
- format console
|
|
- level INFO
|
|
- }
|
|
+ # Enable access logs
|
|
+ log {
|
|
+ output file /var/log/caddy/poweradmin.log {
|
|
+ roll_size 100mb
|
|
+ roll_keep 5
|
|
+ roll_keep_for 720h
|
|
+ }
|
|
+ format console
|
|
+ level INFO
|
|
+ }
|
|
|
|
- # Enable gzip compression
|
|
- encode gzip
|
|
+ # Enable gzip compression
|
|
+ encode gzip
|
|
|
|
- # Security: Deny access to sensitive directories
|
|
- @denied path /config* /lib* /tests* /vendor*
|
|
- @bootstrap path /vendor/twbs/bootstrap* /vendor/twbs/bootstrap-icons*
|
|
+ # Security: Deny access to sensitive directories
|
|
+ @denied path /config* /lib* /tests* /vendor*
|
|
+ @bootstrap path /vendor/twbs/bootstrap* /vendor/twbs/bootstrap-icons*
|
|
|
|
- # Allow Bootstrap files (override general vendor blocking)
|
|
- handle @bootstrap {
|
|
- file_server
|
|
- }
|
|
+ # Allow Bootstrap files (override general vendor blocking)
|
|
+ handle @bootstrap {
|
|
+ file_server
|
|
+ }
|
|
|
|
- # Block sensitive directories (excluding bootstrap)
|
|
- handle @denied {
|
|
- respond "Forbidden" 403
|
|
- }
|
|
+ # Block sensitive directories (excluding bootstrap)
|
|
+ handle @denied {
|
|
+ respond "Forbidden" 403
|
|
+ }
|
|
|
|
- # Security: Deny access to hidden files and sensitive file types
|
|
- @hidden path .* *.sql *.sqlite *.sqlite3 *.db *.md *.log *.yaml *.yml
|
|
- handle @hidden {
|
|
- respond "Forbidden" 403
|
|
- }
|
|
+ # Security: Deny access to hidden files and sensitive file types
|
|
+ @hidden path .* *.sql *.sqlite *.sqlite3 *.db *.md *.log *.yaml *.yml
|
|
+ handle @hidden {
|
|
+ respond "Forbidden" 403
|
|
+ }
|
|
|
|
- # Static assets with caching
|
|
- @static path *.js *.css *.png *.jpg *.jpeg *.gif *.ico *.svg *.woff *.woff2 *.ttf *.eot
|
|
- handle @static {
|
|
- header Cache-Control "public, max-age=31536000"
|
|
- file_server
|
|
- }
|
|
+ # Static assets with caching
|
|
+ @static path *.js *.css *.png *.jpg *.jpeg *.gif *.ico *.svg *.woff *.woff2 *.ttf *.eot
|
|
+ handle @static {
|
|
+ header Cache-Control "public, max-age=31536000"
|
|
+ file_server
|
|
+ }
|
|
|
|
- # Handle OPTIONS preflight requests for CORS
|
|
- @options method OPTIONS
|
|
- handle @options {
|
|
- header Access-Control-Allow-Origin "*"
|
|
- header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS"
|
|
- header Access-Control-Allow-Headers "Content-Type, Authorization, X-API-Key"
|
|
- header Access-Control-Max-Age "3600"
|
|
- respond "" 204
|
|
- }
|
|
+ # Handle OPTIONS preflight requests for CORS
|
|
+ @options method OPTIONS
|
|
+ handle @options {
|
|
+ header Access-Control-Allow-Origin "*"
|
|
+ header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS"
|
|
+ header Access-Control-Allow-Headers "Content-Type, Authorization, X-API-Key"
|
|
+ header Access-Control-Max-Age "3600"
|
|
+ respond "" 204
|
|
+ }
|
|
|
|
- # API endpoints with CORS
|
|
- @api path /api*
|
|
- handle @api {
|
|
- header Access-Control-Allow-Origin "*"
|
|
- header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS"
|
|
- header Access-Control-Allow-Headers "Content-Type, Authorization, X-API-Key"
|
|
- header Access-Control-Max-Age "3600"
|
|
+ # API endpoints with CORS
|
|
+ @api path /api*
|
|
+ handle @api {
|
|
+ header Access-Control-Allow-Origin "*"
|
|
+ header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS"
|
|
+ header Access-Control-Allow-Headers "Content-Type, Authorization, X-API-Key"
|
|
+ header Access-Control-Max-Age "3600"
|
|
|
|
- # Forward all API requests to index.php with proper query handling
|
|
- rewrite * /index.php{uri}
|
|
- php_fastcgi unix//run/php/php-fpm.sock {
|
|
- read_timeout 180s
|
|
- env HTTP_AUTHORIZATION {http.request.header.Authorization}
|
|
- }
|
|
- }
|
|
+ # Forward all API requests to index.php with proper query handling
|
|
+ rewrite * /index.php{uri}
|
|
+ php_fastcgi localhost:9000 {
|
|
+ read_timeout 180s
|
|
+ env HTTP_AUTHORIZATION {http.request.header.Authorization}
|
|
+ }
|
|
+ }
|
|
|
|
- # DDNS update endpoints (for dynamic DNS functionality)
|
|
- rewrite /update /dynamic_update.php
|
|
- rewrite /nic/update /dynamic_update.php
|
|
+ # DDNS update endpoints (for dynamic DNS functionality)
|
|
+ rewrite /update /dynamic_update.php
|
|
+ rewrite /nic/update /dynamic_update.php
|
|
|
|
- # Clean URL routing - let Symfony Router handle all routing
|
|
- try_files {path} {path}/ /index.php{uri}
|
|
+ # Clean URL routing - let Symfony Router handle all routing
|
|
+ try_files {path} {path}/ /index.php{uri}
|
|
|
|
- # PHP handling
|
|
- php_fastcgi unix//run/php/php-fpm.sock {
|
|
- read_timeout 180s
|
|
- env HTTP_AUTHORIZATION {http.request.header.Authorization}
|
|
- }
|
|
+ # PHP handling
|
|
+ php_fastcgi localhost:9000 {
|
|
+ read_timeout 180s
|
|
+ env HTTP_AUTHORIZATION {http.request.header.Authorization}
|
|
+ }
|
|
|
|
- # Enable file server for static content
|
|
- file_server
|
|
+ # Enable file server for static content
|
|
+ file_server
|
|
}
|
|
|
|
# ============================================================================
|
|
@@ -117,7 +118,7 @@
|
|
# Uncomment and adjust the configuration below:
|
|
|
|
# :80 {
|
|
-# root * /srv/www
|
|
+# root * %%WWWDIR%%
|
|
#
|
|
# # Enable access logs
|
|
# log {
|
|
@@ -140,7 +141,7 @@
|
|
#
|
|
# handle @bootstrap {
|
|
# file_server {
|
|
-# root /srv/www/poweradmin
|
|
+# root %%WWWDIR%%
|
|
# }
|
|
# }
|
|
#
|
|
@@ -159,7 +160,7 @@
|
|
# handle @static {
|
|
# header Cache-Control "public, max-age=31536000"
|
|
# file_server {
|
|
-# root /srv/www/poweradmin
|
|
+# root %%WWWDIR%%
|
|
# }
|
|
# }
|
|
#
|
|
@@ -182,8 +183,8 @@
|
|
# header Access-Control-Max-Age "3600"
|
|
#
|
|
# rewrite * /index.php{uri}
|
|
-# php_fastcgi unix//run/php/php-fpm.sock {
|
|
-# root /srv/www/poweradmin
|
|
+# php_fastcgi localhost:9000 {
|
|
+# root %%WWWDIR%%
|
|
# read_timeout 180s
|
|
# env HTTP_AUTHORIZATION {http.request.header.Authorization}
|
|
# }
|
|
@@ -197,18 +198,18 @@
|
|
# try_files {path} {path}/ /index.php{uri}
|
|
#
|
|
# # PHP handling
|
|
-# php_fastcgi unix//run/php/php-fpm.sock {
|
|
-# root /srv/www/poweradmin
|
|
+# php_fastcgi localhost:9000 {
|
|
+# root %%WWWDIR%%
|
|
# read_timeout 180s
|
|
# env HTTP_AUTHORIZATION {http.request.header.Authorization}
|
|
# }
|
|
#
|
|
# # Enable file server
|
|
# file_server {
|
|
-# root /srv/www/poweradmin
|
|
+# root %%WWWDIR%%
|
|
# }
|
|
# }
|
|
#
|
|
# # Serve other content from root if needed
|
|
# file_server
|
|
-# }
|
|
\ No newline at end of file
|
|
+# }
|