mirror of
https://github.com/outbackdingo/Mailu.git
synced 2026-01-27 10:19:35 +00:00
112 lines
3.0 KiB
Plaintext
112 lines
3.0 KiB
Plaintext
server {
|
|
listen 80 default_server;
|
|
{% if SUBNET6 %}
|
|
listen [::]:80 default_server;
|
|
{% endif %}
|
|
resolver {{ RESOLVER }} valid=30s;
|
|
|
|
{% if WEBMAIL == 'roundcube' %}
|
|
root /var/www/{{ WEBMAIL }}/public_html;
|
|
{% else %}
|
|
root /var/www/{{ WEBMAIL }};
|
|
{% endif %}
|
|
|
|
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 }};
|
|
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;
|
|
|
|
real_ip_header X-Real-IP;
|
|
set_real_ip_from {{ FRONT_ADDRESS or "front" }};
|
|
|
|
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 %}
|
|
fastcgi_param REQUEST_METHOD $request_method;
|
|
fastcgi_param CONTENT_TYPE $content_type;
|
|
fastcgi_param CONTENT_LENGTH $content_length;
|
|
fastcgi_param PATH_INFO $fastcgi_path_info;
|
|
|
|
# unclear why this is required, see #3913
|
|
fastcgi_buffers 16 32k;
|
|
fastcgi_buffer_size 64k;
|
|
fastcgi_busy_buffers_size 64k;
|
|
|
|
# nginx buffers #
|
|
proxy_buffer_size 128k;
|
|
proxy_buffers 4 256k;
|
|
proxy_busy_buffers_size 256k;
|
|
}
|
|
|
|
# Assets cache control
|
|
# --------------------------------------
|
|
location ~* \.(?:html|xml|json)$ {
|
|
expires -1;
|
|
}
|
|
|
|
location ~* \.(?:css|js)$ {
|
|
expires 7d;
|
|
add_header Pragma public;
|
|
add_header Cache-Control "public";
|
|
}
|
|
|
|
location ~* \.(?:gif|jpe?g|png|ico|otf|eot|svg|ttf|woff|woff2)$ {
|
|
expires 30d;
|
|
log_not_found off;
|
|
add_header Pragma public;
|
|
add_header Cache-Control "public";
|
|
}
|
|
|
|
location ~ (^|/)\. {
|
|
deny all;
|
|
}
|
|
|
|
location ~* /(config|temp|logs|data) {
|
|
deny all;
|
|
}
|
|
|
|
location = /ping {
|
|
allow 127.0.0.1;
|
|
allow ::1;
|
|
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;
|
|
}
|
|
}
|