Files
server/opt/psa/admin/conf/templates/default/server/nginxPleskAccess.php
2026-01-07 20:52:11 +01:00

79 lines
2.7 KiB
PHP

<?php /** @var Template_VariableAccessor $VAR */ ?>
<?php /** @var array $OPT */ ?>
<?php if (!$VAR->panel->isHttpsProxyEnabled): ?>
<?php return ?>
<?php endif ?>
server {
<?php foreach ($VAR->server->ipAddresses->all as $ipAddress): ?>
<?php if ($VAR->server->nginx->http3) : ?>
listen <?php echo $ipAddress->escapedAddress . ':' . $VAR->server->nginx->httpsPort ?> quic <?php echo ($OPT['reuseport'] ?? false) ? 'reuseport' : '' ?>;
<?php endif ?>
listen <?php echo $ipAddress->escapedAddress . ':' . $VAR->server->nginx->httpsPort . ' ssl' ?>;
<?php endforeach ?>
<?php if ($VAR->server->nginx->http3) : ?>
add_header Alt-Svc <?php echo '\'h3=":' . $VAR->server->nginx->httpsPort . '"; ma=86400\'' ?>;
<?php endif ?>
<?php if ($VAR->server->nginx->http2) : ?>
http2 on;
<?php endif ?>
<?php $sslCertificate = $VAR->panel->sslCertificate ?>
<?php if ($sslCertificate->ceFilePath): ?>
ssl_certificate "<?=$sslCertificate->ceFilePath?>";
ssl_certificate_key "<?=$sslCertificate->ceFilePath?>";
<?php endif ?>
client_max_body_size 2048m;
proxy_read_timeout 600;
proxy_send_timeout 600;
proxy_max_temp_file_size 0;
proxy_buffers 16 16k;
proxy_buffer_size 32k;
proxy_busy_buffers_size 32k;
<?php if (!$VAR->panel->isDefaultAccessDomain) { ?>
server_name <?= $VAR->quote($VAR->panel->accessDomainName) ?>;
<?php } else { ?>
server_name _;
<?php } ?>
<?php if ($VAR->panel->isNginxModSecurityEnabled) { ?>
modsecurity_rules '
SecRuleEngine Off
';
<?php } ?>
location / {
proxy_pass http://127.0.0.1:8880;
proxy_redirect http://$host:8880 $scheme://$host;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Http-Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
access_log off;
gzip on;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;
}
location ~ /(ws|websocket)(/|$) {
proxy_pass http://127.0.0.1:8880;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Http-Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
access_log off;
}
underscores_in_headers on;
}