PROBLEM
autodiscover and autoconfig are not working on my server.
ENVIRONMENT
- atmail mail server
CAUSE
Missing Nginx configuration.
RESOLUTION
To enable autodiscover and autoconfig on your atmail installation, edit your Nginx configuration as follows.
- Open and edit /etc/nginx/conf.d/atmail-mailserver.locations.
- Append the following code block to this file.
location /autodiscover/autodiscover.xml {
Example
rewrite /autodiscover/autodiscover.xml /autodiscover/index.php break;
proxy_set_header Host $host;
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;
proxy_pass http://127.0.0.1;
proxy_read_timeout 1800;
server_tokens off;
}
location ~ ^/.well-known/autoconfig/mail/config-v(.*).xml {
rewrite ^/.well-known/autoconfig/mail/config-v(.*).xml /autodiscover/index.php?v=$1&args break;
proxy_set_header Host $host;
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;
proxy_pass http://127.0.0.1;
proxy_read_timeout 1800;
server_tokens off;
}
location ~ /.well-known/ms/(.*) {
return 307 https://$host/admin/index.php/api/$1;
}
location /admin {
alias /usr/share/atmail/mailserver/webui;
index index.php;
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_read_timeout 1800;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}
location /autodiscover/autodiscover.xml {
rewrite /autodiscover/autodiscover.xml /autodiscover/index.php break;
proxy_set_header Host $host;
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;
proxy_pass http://127.0.0.1;
proxy_read_timeout 1800;
server_tokens off;
}
location ~ ^/.well-known/autoconfig/mail/config-v(.*).xml {
rewrite ^/.well-known/autoconfig/mail/config-v(.*).xml /autodiscover/index.php?v=$1&args break;
proxy_set_header Host $host;
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;
proxy_pass http://127.0.0.1;
proxy_read_timeout 1800;
server_tokens off;
} - Save changes and restart Nginx.
systemctl restart nginx
- Go to the Webadmin > Account manager > select domain > and click Update domain to enable the Third party auto configuration settings.
- Setup of autodiscover and autoconfig is now complete.
Comments