Custom sites
-To create persistent (over updates) sites hosted by mailcow: dockerized, a new site configuration must be placed inside data/conf/nginx/
:
SSL¶
+Please see Advanced SSL and explicitly check ADDITIONAL_SERVER_NAMES
for SSL configuration.
Please do not add ADDITIONAL_SERVER_NAMES when you plan to use a different web root.
+New site¶
+To create persistent (over updates) sites hosted by mailcow: dockerized, a new site configuration must be placed inside data/conf/nginx/
:
A good template to begin with:
nano data/conf/nginx/my_custom_site.conf
A good template to begin with:
server {
ssl_certificate /etc/ssl/mail/cert.pem;
ssl_certificate_key /etc/ssl/mail/key.pem;
@@ -1804,15 +1913,20 @@
ssl_session_tickets off;
index index.php index.html;
client_max_body_size 0;
+ # Location: data/web
root /web;
- include /etc/nginx/conf.d/listen_plain.active;
+ # Location: data/web/mysite.com
+ #root /web/mysite.com
+ include /etc/nginx/conf.d/listen_plain.active;
include /etc/nginx/conf.d/listen_ssl.active;
- server_name mysite.example.org;
- server_tokens off;
+ server_name mysite.example.org;
+ server_tokens off;
+ # This allows acme to be validated even with a different web root
location ^~ /.well-known/acme-challenge/ {
- allow all;
default_type "text/plain";
+ rewrite /.well-known/acme-challenge/(.*) /$1 break;
+ root /web/.well-known/acme-challenge/;
}
if ($scheme = http) {
@@ -1820,7 +1934,10 @@
}
}
New site with proxy to a remote location¶
Another example with a reverse proxy configuration:
+nano data/conf/nginx/my_custom_site.conf
+
server {
ssl_certificate /etc/ssl/mail/cert.pem;
ssl_certificate_key /etc/ssl/mail/key.pem;
@@ -1858,11 +1975,12 @@
}
}
The filename is not important, as long as the filename carries a .conf extension.
+Config expansion in mailcows Nginx¶
+The filename used for a new site is not important, as long as the filename carries a .conf extension.
It is also possible to extend the configuration of the default file site.conf
file:
nano data/conf/nginx/site.my_content.custom
This filename does not need to have a ".conf" extension, but follows the pattern site.*.custom
, where *
is a custom name.
This filename does not need to have a ".conf" extension but follows the pattern site.*.custom
, where *
is a custom name.
If PHP is to be included in a custom site, please use the PHP-FPM listener on phpfpm:9002 or create a new listener in data/conf/phpfpm/php-fpm.d/pools.conf
.
Restart Nginx (and PHP-FPM, if a new listener was created):
docker-compose restart nginx-mailcow
diff --git a/u_e-postfix-attachment_size/index.html b/u_e-postfix-attachment_size/index.html
index 4cacfd067..5376e5e4d 100644
--- a/u_e-postfix-attachment_size/index.html
+++ b/u_e-postfix-attachment_size/index.html
@@ -12,7 +12,7 @@
-
+
diff --git a/u_e-postfix-custom_transport/index.html b/u_e-postfix-custom_transport/index.html
index 07ba2ffb9..734c7a23f 100644
--- a/u_e-postfix-custom_transport/index.html
+++ b/u_e-postfix-custom_transport/index.html
@@ -12,7 +12,7 @@
-
+
diff --git a/u_e-postfix-disable_sender_verification/index.html b/u_e-postfix-disable_sender_verification/index.html
index 7a5c1618a..a49aff137 100644
--- a/u_e-postfix-disable_sender_verification/index.html
+++ b/u_e-postfix-disable_sender_verification/index.html
@@ -12,7 +12,7 @@
-
+
diff --git a/u_e-postfix-extra_cf/index.html b/u_e-postfix-extra_cf/index.html
index 9be01df01..ea490acba 100644
--- a/u_e-postfix-extra_cf/index.html
+++ b/u_e-postfix-extra_cf/index.html
@@ -12,7 +12,7 @@
-
+
diff --git a/u_e-postfix-pflogsumm/index.html b/u_e-postfix-pflogsumm/index.html
index 707898a99..716f455e3 100644
--- a/u_e-postfix-pflogsumm/index.html
+++ b/u_e-postfix-pflogsumm/index.html
@@ -12,7 +12,7 @@
-
+
diff --git a/u_e-postfix-postscreen_whitelist/index.html b/u_e-postfix-postscreen_whitelist/index.html
index 7ca0a488f..fd7e94a00 100644
--- a/u_e-postfix-postscreen_whitelist/index.html
+++ b/u_e-postfix-postscreen_whitelist/index.html
@@ -12,7 +12,7 @@
-
+
diff --git a/u_e-redis/index.html b/u_e-redis/index.html
index 07d5015fd..bcfc3b6b5 100644
--- a/u_e-redis/index.html
+++ b/u_e-redis/index.html
@@ -12,7 +12,7 @@
-
+
diff --git a/u_e-reeanble-weak-protocols/index.html b/u_e-reeanble-weak-protocols/index.html
index 132ca3596..dd5248597 100644
--- a/u_e-reeanble-weak-protocols/index.html
+++ b/u_e-reeanble-weak-protocols/index.html
@@ -12,7 +12,7 @@
-
+
diff --git a/u_e-rspamd/index.html b/u_e-rspamd/index.html
index 0d0f8edc7..a52deb7bc 100644
--- a/u_e-rspamd/index.html
+++ b/u_e-rspamd/index.html
@@ -12,7 +12,7 @@
-
+
diff --git a/u_e-sogo/index.html b/u_e-sogo/index.html
index 8f1961e2f..465ab4eb4 100644
--- a/u_e-sogo/index.html
+++ b/u_e-sogo/index.html
@@ -12,7 +12,7 @@
-
+
diff --git a/u_e-unbound-fwd/index.html b/u_e-unbound-fwd/index.html
index 710dbffa3..45e175fc7 100644
--- a/u_e-unbound-fwd/index.html
+++ b/u_e-unbound-fwd/index.html
@@ -12,7 +12,7 @@
-
+
diff --git a/u_e-webmail-site/index.html b/u_e-webmail-site/index.html
index b34926818..9b8d694c4 100644
--- a/u_e-webmail-site/index.html
+++ b/u_e-webmail-site/index.html
@@ -12,7 +12,7 @@
-
+
diff --git a/u_e-why_unbound/index.html b/u_e-why_unbound/index.html
index c9ec1a07b..ec8e031c9 100644
--- a/u_e-why_unbound/index.html
+++ b/u_e-why_unbound/index.html
@@ -12,7 +12,7 @@
-
+