2022-11-10 17:51:22 +02:00
|
|
|
server {
|
|
|
|
listen 80 default_server;
|
|
|
|
listen [::]:80 default_server;
|
|
|
|
|
2022-11-12 16:34:43 +02:00
|
|
|
{% if WEBMAIL == 'roundcube' %}
|
|
|
|
root /var/www/{{ WEBMAIL }}/public_html;
|
|
|
|
{% else %}
|
2022-11-12 12:34:58 +02:00
|
|
|
root /var/www/{{ WEBMAIL }};
|
2022-11-12 16:34:43 +02:00
|
|
|
{% endif %}
|
2022-11-10 17:51:22 +02:00
|
|
|
|
|
|
|
include /etc/nginx/mime.types;
|
|
|
|
|
|
|
|
# /dev/stdout (Default), <path>, off
|
|
|
|
access_log off;
|
|
|
|
|
|
|
|
# /dev/stderr (Default), <path>, debug, info, notice, warn, error, crit, alert, emerg
|
|
|
|
error_log /dev/stderr notice;
|
|
|
|
|
|
|
|
index index.php;
|
|
|
|
|
|
|
|
# set maximum body size to configured limit
|
|
|
|
client_max_body_size {{ MESSAGE_SIZE_LIMIT|int + 8388608 }};
|
2022-11-12 15:50:30 +02:00
|
|
|
fastcgi_hide_header X-Powered-By;
|
|
|
|
add_header X-Download-Options "noopen" always;
|
|
|
|
add_header X-Robots-Tag "none" always;
|
|
|
|
add_header X-Permitted-Cross-Domain-Policies "none" always;
|
|
|
|
add_header Referrer-Policy "no-referrer" always;
|
2022-11-10 17:51:22 +02:00
|
|
|
|
2023-01-28 18:37:16 +02:00
|
|
|
real_ip_header X-Real-IP;
|
|
|
|
{% for from_ip in SUBNET.split(',') %}
|
|
|
|
set_real_ip_from {{ from_ip }};
|
|
|
|
{% endfor %}
|
|
|
|
{% if SUBNET6 %}{% for from_ip in SUBNET6.split(',') %}
|
|
|
|
set_real_ip_from {{ from_ip }};
|
|
|
|
{% endfor %}{% endif %}
|
|
|
|
|
2022-11-10 17:51:22 +02:00
|
|
|
location / {
|
|
|
|
try_files $uri $uri/ /index.php$args;
|
|
|
|
}
|
|
|
|
|
|
|
|
location ~ \.php$ {
|
|
|
|
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
|
|
|
if (!-f $document_root$fastcgi_script_name) {
|
|
|
|
return 404;
|
|
|
|
}
|
|
|
|
include /etc/nginx/fastcgi_params;
|
|
|
|
|
|
|
|
fastcgi_intercept_errors on;
|
|
|
|
fastcgi_index index.php;
|
|
|
|
|
|
|
|
fastcgi_keep_conn on;
|
|
|
|
|
|
|
|
fastcgi_pass unix:/var/run/php8-fpm.sock;
|
|
|
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
|
|
|
{% if WEB_WEBMAIL == '/' %}
|
|
|
|
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
|
|
|
|
{% else %}
|
|
|
|
fastcgi_param SCRIPT_NAME {{WEB_WEBMAIL}}/$fastcgi_script_name;
|
|
|
|
{% endif %}
|
|
|
|
}
|
|
|
|
|
2022-11-12 15:50:30 +02:00
|
|
|
location ~ (^|/)\. {
|
2022-11-10 17:51:22 +02:00
|
|
|
deny all;
|
|
|
|
}
|
|
|
|
|
2022-11-13 15:34:25 +02:00
|
|
|
location ~* /(config|temp|logs|data) {
|
2022-11-10 17:51:22 +02:00
|
|
|
deny all;
|
|
|
|
}
|
|
|
|
|
|
|
|
location = /ping {
|
|
|
|
allow 127.0.0.1;
|
2022-11-10 21:03:26 +02:00
|
|
|
allow ::1;
|
2022-11-10 17:51:22 +02:00
|
|
|
deny all;
|
|
|
|
|
|
|
|
include /etc/nginx/fastcgi_params;
|
|
|
|
fastcgi_index index.php;
|
|
|
|
fastcgi_pass unix:/var/run/php8-fpm.sock;
|
|
|
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
|
|
|
}
|
|
|
|
}
|