I have created an autodiscovery for mail that uses 5 Plesk servers.
For this I use nginx and a PHP-socket.
In /etc/nginx/conf.d I have this file:
/etc/nginx/conf.d/zz005_autodiscover.conf
By examining the server with netstat I saw that on 1 server it was running on tcp port 9000
On that server I could use
on 3 other servers it was a unix socket and there I use
On the 5th server I have a problem.
There is no socket already running.
I read this page: https://support.rackspace.com/how-to/install-nginx-and-php-fpm-running-on-unix-file-sockets/
But when I go to /etc/php5/fpm/pool.d I can see that Plesk deliberately turned off by making a new www.conf and renaming the original one to www.conf.saved_by_psa
I don't have that much experience with how this is used and I'm a bit afraid to break something.
The whole autoconfiguration / autodiscovery system is working now and it would be a shame if this server stops me from implementing it.
For this I use nginx and a PHP-socket.
In /etc/nginx/conf.d I have this file:
/etc/nginx/conf.d/zz005_autodiscover.conf
Code:
server {
listen *:80;
server_name ~^autoconfig\.[a-z0-9-]+\.[a-z0-9-]+$;
root /var/www/autoconfig_autodiscover;
index index.html;
error_log /var/log/nginx/autoconfig_autodiscover/error.log;
access_log /var/log/nginx/autoconfig_autodiscover/access.log combined;
location /mail/config-v1.1.xml {
try_files $uri /config-v1.1.xml.php?$args;
rewrite ^(.+)$ /config-v1.1.xml.php?$1 last;
}
location ~ config-v1\.1\.xml\.php$ {
try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SERVER_FQDN $host;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_intercept_errors on;
}
}
server {
listen *:443 ssl;
server_name ~^[a-z0-9-]+-[a-z0-9-]+\.provider.com$;
root /var/www/autoconfig_autodiscover;
error_log /var/log/nginx/autoconfig_autodiscover/error.log;
access_log /var/log/nginx/autoconfig_autodiscover/access.log combined;
ssl_certificate /root/.ssh/wildcard.provider.com.pem;
ssl_certificate_key /root/.ssh/wildcard.provider.com.key;
ssl_stapling on;
ssl_stapling_verify on;
ssl_session_timeout 5m;
# ssl_protocols SSLv2 SSLv3 TLSv1;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
ssl_dhparam /etc/ssl/certs/dhparam.pem;
client_max_body_size 1m;
index index.php index.html index.htm;
location /autodiscover/autodiscover.xml {
try_files $uri /autodiscover.xml.php?$args;
rewrite ^(.+)$ /autodiscover.xml.php?$1 last;
}
location ~ autodiscover\.xml\.php$ {
try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SERVER_FQDN $host;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_intercept_errors on;
}
}
By examining the server with netstat I saw that on 1 server it was running on tcp port 9000
On that server I could use
Code:
fastcgi_pass 127.0.0.1:9000;
Code:
fastcgi_pass unix:/run/php/php7.0-fpm.sock
On the 5th server I have a problem.
There is no socket already running.
I read this page: https://support.rackspace.com/how-to/install-nginx-and-php-fpm-running-on-unix-file-sockets/
But when I go to /etc/php5/fpm/pool.d I can see that Plesk deliberately turned off by making a new www.conf and renaming the original one to www.conf.saved_by_psa
I don't have that much experience with how this is used and I'm a bit afraid to break something.
The whole autoconfiguration / autodiscovery system is working now and it would be a shame if this server stops me from implementing it.