I would like to setup a webmail mail.
subdomain for every domain I have on my server, using nginx.
It seems to work on https://mail.mydomain.com
but I can also access the webmail by visiting the server's IP address (https://x.x.x.x), which is not wanted.
Here is my conf file for the webmail:
###
# Webmail (Rainloop)
###
server {
listen 80;
server_name mail*.;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
server_name mail*.;
ssl_certificate /etc/ssl/nginx/server.crt;
ssl_certificate_key /etc/ssl/nginx/server.key;
ssl_protocols SSLv3 TLSv1;
ssl_ciphers HIGH:!aNULL:!MD5;
access_log /var/log/nginx/app-webmail.access.log;
error_log /var/log/nginx/app-webmail.error.log;
location / {
root /var/www/rainloop;
index index.html index.htm index.php;
location ~ [^/]\.php(/|$) {
include fcgi.conf;
fastcgi_pass unix:/var/run/php-fcgi.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location ^~ /data {
deny all;
}
}
}
Any idea?