--- nginx.conf.example.orig 2026-07-30 02:02:57 UTC +++ nginx.conf.example @@ -7,8 +7,8 @@ server { # ============================================================================ server { listen 80; - server_name your-domain.com; - root /path/to/poweradmin; + server_name example.com; + root %%WWWDIR%%; index index.php index.html; # Static assets (caching) @@ -41,9 +41,9 @@ server { # Handle PHP files location ~ \.php$ { # Adjust the fastcgi_pass directive based on your PHP-FPM configuration - # For socket: fastcgi_pass unix:/var/run/php/php8.2-fpm.sock; + # For socket: fastcgi_pass unix:/var/run/php/php-fpm.sock; # For TCP: fastcgi_pass 127.0.0.1:9000; - fastcgi_pass unix:/var/run/php/php8.2-fpm.sock; + fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_read_timeout 180; @@ -83,75 +83,75 @@ server { # Use this configuration when Poweradmin is installed in a subfolder # Remember to also set 'base_url_prefix' => '/poweradmin' in config/settings.php -server { - listen 80; - server_name your-domain.com; - root /var/www/html; - index index.php index.html; - - # Poweradmin subfolder location - location /poweradmin { - # Try to serve the file directly, fallback to index.php - try_files $uri $uri/ /poweradmin/index.php$is_args$args; - - # Static assets (caching) - location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ { - expires max; - log_not_found off; - access_log off; - } - - # API handling with CORS - location ~ ^/poweradmin/api { - add_header Access-Control-Allow-Origin "*" always; - add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS" always; - add_header Access-Control-Allow-Headers "Content-Type, Authorization, X-API-Key" always; - add_header Access-Control-Max-Age "3600" always; - - # Handle OPTIONS pre-flight requests - if ($request_method = 'OPTIONS') { - return 204; - } - - try_files $uri $uri/ /poweradmin/index.php$is_args$args; - } - - # Handle PHP files within the poweradmin subfolder - location ~ ^/poweradmin/.*\.php$ { - # Adjust the fastcgi_pass directive based on your PHP-FPM configuration - # For socket: fastcgi_pass unix:/var/run/php/php8.2-fpm.sock; - # For TCP: fastcgi_pass 127.0.0.1:9000; - fastcgi_pass unix:/var/run/php/php8.2-fpm.sock; - fastcgi_index index.php; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - fastcgi_read_timeout 180; - include fastcgi_params; - - # Ensure HTTP Authorization header is forwarded for API authentication - fastcgi_param HTTP_AUTHORIZATION $http_authorization; - } - - # Security: Deny access to sensitive files and directories - location ~ ^/poweradmin/\. { - deny all; - } - - # Allow access to Bootstrap CSS/JS and Bootstrap Icons in vendor/twbs/ - location ~ ^/poweradmin/vendor/twbs/(bootstrap|bootstrap-icons)/ { - allow all; - } - - location ~ ^/poweradmin/(config|lib|tests|vendor)/ { - deny all; - } - - location ~ ^/poweradmin/.*\.(sql|md|log)$ { - deny all; - } - } - - # Optional: Enable logging for debugging - # rewrite_log on; - # error_log /var/log/nginx/poweradmin_error.log notice; - # access_log /var/log/nginx/poweradmin_access.log; -} \ No newline at end of file +#server { +# listen 80; +# server_name example.com; +# root %%WWWDIR%%; +# index index.php index.html; +# +# # Poweradmin subfolder location +# location /poweradmin { +# # Try to serve the file directly, fallback to index.php +# try_files $uri $uri/ /poweradmin/index.php$is_args$args; +# +# # Static assets (caching) +# location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ { +# expires max; +# log_not_found off; +# access_log off; +# } +# +# # API handling with CORS +# location ~ ^/poweradmin/api { +# add_header Access-Control-Allow-Origin "*" always; +# add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS" always; +# add_header Access-Control-Allow-Headers "Content-Type, Authorization, X-API-Key" always; +# add_header Access-Control-Max-Age "3600" always; +# +# # Handle OPTIONS pre-flight requests +# if ($request_method = 'OPTIONS') { +# return 204; +# } +# +# try_files $uri $uri/ /poweradmin/index.php$is_args$args; +# } +# +# # Handle PHP files within the poweradmin subfolder +# location ~ ^/poweradmin/.*\.php$ { +# # Adjust the fastcgi_pass directive based on your PHP-FPM configuration +# # For socket: fastcgi_pass unix:/var/run/php/php8.2-fpm.sock; +# # For TCP: fastcgi_pass 127.0.0.1:9000; +# fastcgi_pass 127.0.0.1:9000; +# fastcgi_index index.php; +# fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; +# fastcgi_read_timeout 180; +# include fastcgi_params; +# +# # Ensure HTTP Authorization header is forwarded for API authentication +# fastcgi_param HTTP_AUTHORIZATION $http_authorization; +# } +# +# # Security: Deny access to sensitive files and directories +# location ~ ^/poweradmin/\. { +# deny all; +# } +# +# # Allow access to Bootstrap CSS/JS and Bootstrap Icons in vendor/twbs/ +# location ~ ^/poweradmin/vendor/twbs/(bootstrap|bootstrap-icons)/ { +# allow all; +# } +# +# location ~ ^/poweradmin/(config|lib|tests|vendor)/ { +# deny all; +# } +# +# location ~ ^/poweradmin/.*\.(sql|md|log)$ { +# deny all; +# } +# } +# +# # Optional: Enable logging for debugging +# # rewrite_log on; +# # error_log /var/log/nginx/poweradmin_error.log notice; +# # access_log /var/log/nginx/poweradmin_access.log; +#}