104 lines
2.7 KiB
PHP
104 lines
2.7 KiB
PHP
# Copyright 1999-2025. WebPros International GmbH. All rights reserved.
|
|
underscores_in_headers on;
|
|
access_log /var/log/plesk/httpsd_access_log main buffer=8k;
|
|
|
|
index index.php;
|
|
root /opt/psa/admin/htdocs;
|
|
|
|
# Maintenance
|
|
include conf.d/maintenance;
|
|
if ($uri ~* \.(ico|css|js|gif|jpe?g|png|html|json|svg|woff2)(\?[0-9]+)? ) {
|
|
set $maintenance off;
|
|
}
|
|
|
|
if ($maintenance = on) {
|
|
return 503;
|
|
}
|
|
|
|
error_page 503 @maintenance;
|
|
location @maintenance {
|
|
if ($maintenance = on) {
|
|
rewrite ^(.*)$ /error_docs/503.1.html break;
|
|
}
|
|
rewrite ^(.*)$ /error_docs/503.html break;
|
|
internal;
|
|
}
|
|
|
|
location /maintenance/ { root /usr/local/psa/var/; }
|
|
# End: maintenance
|
|
|
|
location /extras/ {
|
|
alias /usr/local/psa/admin/share/modules/;
|
|
}
|
|
|
|
# Admin panel
|
|
location /admin {
|
|
alias /opt/psa/admin/application/admin/public;
|
|
try_files $uri @route;
|
|
}
|
|
|
|
# SMB panel
|
|
location /smb {
|
|
alias /opt/psa/admin/application/smb/public;
|
|
try_files $uri @route;
|
|
}
|
|
|
|
location @route {
|
|
include /etc/sw-cp-server/fastcgi_params;
|
|
fastcgi_pass unix:/var/run/sw-engine.sock;
|
|
fastcgi_param PATH_INFO $fastcgi_path_info;
|
|
fastcgi_param SCRIPT_FILENAME /opt/psa/admin/htdocs/application.php;
|
|
fastcgi_param HTTP_PRAGMA $http_pragma;
|
|
}
|
|
|
|
# Custom skins
|
|
location ~ ^/theme-skins {
|
|
deny all;
|
|
location ~ "\.(css|gif|png|jpg|jpeg|webp|svg|xml|woff|woff2)$" {
|
|
allow all;
|
|
try_files $uri @default-skin;
|
|
}
|
|
}
|
|
|
|
location @default-skin {
|
|
rewrite ^/theme-skins/[^/]+/(.*)$ /cp/theme/$1 last;
|
|
}
|
|
|
|
# Backward compatiblity for old URLs
|
|
rewrite (login|login_up|logout)\.php3(/|$) /$1.php$2 last;
|
|
|
|
# New modern
|
|
rewrite ^/login/?$ /login_up.php last;
|
|
|
|
# Rewrite for api
|
|
rewrite ^/api/modules/([^/]*)/(.*)$ /modules/$1/public/index.php/$2 last;
|
|
rewrite ^/api/(.*)$ /modules/rest-api/public/index.php/$1 last;
|
|
|
|
location ~* \.php(/|$) {
|
|
include /etc/sw-cp-server/fastcgi_params;
|
|
fastcgi_pass unix:/var/run/sw-engine.sock;
|
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
|
}
|
|
|
|
# Custom error pages
|
|
error_page 400 401 403 404 405 406 407 412 414 415 500 501 502 503 /error_docs/$status.$error_doc_format;
|
|
|
|
# http to https redirect
|
|
error_page 497 https://$host:$server_port$request_uri;
|
|
|
|
# Content security policy header to prevent XSS and phishing
|
|
add_header X-Content-Type-Options "nosniff";
|
|
location ~ ^/images/logos {
|
|
add_header Content-Security-Policy "default-src 'none'; form-action 'none'; frame-ancestors 'none'; sandbox";
|
|
}
|
|
|
|
# Favicon branding
|
|
location /images/favicon.svg {
|
|
try_files /images/logos/favicon.custom.svg $uri =404;
|
|
}
|
|
|
|
location /favicon.ico {
|
|
try_files /images/logos/favicon.custom.ico $uri =404;
|
|
}
|
|
|