Overwrite existing config
This commit is contained in:
parent
bdf88572e8
commit
8b3fcc8699
|
@ -192,48 +192,21 @@ function install_mailpile {
|
||||||
chmod +x /etc/systemd/system/mailpile.service
|
chmod +x /etc/systemd/system/mailpile.service
|
||||||
|
|
||||||
mailpile_nginx_site=/etc/nginx/sites-available/$MAILPILE_DOMAIN_NAME
|
mailpile_nginx_site=/etc/nginx/sites-available/$MAILPILE_DOMAIN_NAME
|
||||||
if [ ! -f $mailpile_nginx_site ]; then
|
if [[ $ONION_ONLY == "no" ]]; then
|
||||||
if [[ $ONION_ONLY == "no" ]]; then
|
function_check nginx_http_redirect
|
||||||
function_check nginx_http_redirect
|
nginx_http_redirect $MAILPILE_DOMAIN_NAME
|
||||||
nginx_http_redirect $MAILPILE_DOMAIN_NAME
|
|
||||||
echo 'server {' >> $mailpile_nginx_site
|
|
||||||
echo ' listen 443 ssl;' >> $mailpile_nginx_site
|
|
||||||
echo " server_name $MAILPILE_DOMAIN_NAME;" >> $mailpile_nginx_site
|
|
||||||
echo '' >> $mailpile_nginx_site
|
|
||||||
echo ' # Security' >> $mailpile_nginx_site
|
|
||||||
function_check nginx_ssl
|
|
||||||
nginx_ssl $MAILPILE_DOMAIN_NAME
|
|
||||||
|
|
||||||
function_check nginx_disable_sniffing
|
|
||||||
nginx_disable_sniffing $MAILPILE_DOMAIN_NAME
|
|
||||||
|
|
||||||
echo ' add_header Strict-Transport-Security max-age=15768000;' >> $mailpile_nginx_site
|
|
||||||
echo '' >> $mailpile_nginx_site
|
|
||||||
echo ' # Logs' >> $mailpile_nginx_site
|
|
||||||
echo ' access_log off;' >> $mailpile_nginx_site
|
|
||||||
echo ' error_log off;' >> $mailpile_nginx_site
|
|
||||||
echo '' >> $mailpile_nginx_site
|
|
||||||
echo ' # Root' >> $mailpile_nginx_site
|
|
||||||
echo " root /var/www/$MAILPILE_DOMAIN_NAME/mail;" >> $mailpile_nginx_site
|
|
||||||
echo '' >> $mailpile_nginx_site
|
|
||||||
echo ' location / {' >> $mailpile_nginx_site
|
|
||||||
function_check nginx_limits
|
|
||||||
nginx_limits $MAILPILE_DOMAIN_NAME '15m'
|
|
||||||
echo " proxy_pass http://localhost:${MAILPILE_PORT}/;" >> $mailpile_nginx_site
|
|
||||||
echo ' proxy_set_header X-Forwarded-Host $host;' >> $mailpile_nginx_site
|
|
||||||
echo ' proxy_set_header X-Forwarded-Server $host;' >> $mailpile_nginx_site
|
|
||||||
echo ' proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;' >> $mailpile_nginx_site
|
|
||||||
echo ' }' >> $mailpile_nginx_site
|
|
||||||
echo '}' >> $mailpile_nginx_site
|
|
||||||
else
|
|
||||||
echo -n '' > $mailpile_nginx_site
|
|
||||||
fi
|
|
||||||
echo 'server {' >> $mailpile_nginx_site
|
echo 'server {' >> $mailpile_nginx_site
|
||||||
echo " listen 127.0.0.1:$MAILPILE_ONION_PORT default_server;" >> $mailpile_nginx_site
|
echo ' listen 443 ssl;' >> $mailpile_nginx_site
|
||||||
echo " server_name $MAILPILE_DOMAIN_NAME;" >> $mailpile_nginx_site
|
echo " server_name $MAILPILE_DOMAIN_NAME;" >> $mailpile_nginx_site
|
||||||
echo '' >> $mailpile_nginx_site
|
echo '' >> $mailpile_nginx_site
|
||||||
|
echo ' # Security' >> $mailpile_nginx_site
|
||||||
|
function_check nginx_ssl
|
||||||
|
nginx_ssl $MAILPILE_DOMAIN_NAME
|
||||||
|
|
||||||
function_check nginx_disable_sniffing
|
function_check nginx_disable_sniffing
|
||||||
nginx_disable_sniffing $MAILPILE_DOMAIN_NAME
|
nginx_disable_sniffing $MAILPILE_DOMAIN_NAME
|
||||||
|
|
||||||
|
echo ' add_header Strict-Transport-Security max-age=15768000;' >> $mailpile_nginx_site
|
||||||
echo '' >> $mailpile_nginx_site
|
echo '' >> $mailpile_nginx_site
|
||||||
echo ' # Logs' >> $mailpile_nginx_site
|
echo ' # Logs' >> $mailpile_nginx_site
|
||||||
echo ' access_log off;' >> $mailpile_nginx_site
|
echo ' access_log off;' >> $mailpile_nginx_site
|
||||||
|
@ -251,7 +224,32 @@ function install_mailpile {
|
||||||
echo ' proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;' >> $mailpile_nginx_site
|
echo ' proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;' >> $mailpile_nginx_site
|
||||||
echo ' }' >> $mailpile_nginx_site
|
echo ' }' >> $mailpile_nginx_site
|
||||||
echo '}' >> $mailpile_nginx_site
|
echo '}' >> $mailpile_nginx_site
|
||||||
|
else
|
||||||
|
echo -n '' > $mailpile_nginx_site
|
||||||
fi
|
fi
|
||||||
|
echo 'server {' >> $mailpile_nginx_site
|
||||||
|
echo " listen 127.0.0.1:$MAILPILE_ONION_PORT default_server;" >> $mailpile_nginx_site
|
||||||
|
echo " server_name $MAILPILE_DOMAIN_NAME;" >> $mailpile_nginx_site
|
||||||
|
echo '' >> $mailpile_nginx_site
|
||||||
|
function_check nginx_disable_sniffing
|
||||||
|
nginx_disable_sniffing $MAILPILE_DOMAIN_NAME
|
||||||
|
echo '' >> $mailpile_nginx_site
|
||||||
|
echo ' # Logs' >> $mailpile_nginx_site
|
||||||
|
echo ' access_log off;' >> $mailpile_nginx_site
|
||||||
|
echo ' error_log off;' >> $mailpile_nginx_site
|
||||||
|
echo '' >> $mailpile_nginx_site
|
||||||
|
echo ' # Root' >> $mailpile_nginx_site
|
||||||
|
echo " root /var/www/$MAILPILE_DOMAIN_NAME/mail;" >> $mailpile_nginx_site
|
||||||
|
echo '' >> $mailpile_nginx_site
|
||||||
|
echo ' location / {' >> $mailpile_nginx_site
|
||||||
|
function_check nginx_limits
|
||||||
|
nginx_limits $MAILPILE_DOMAIN_NAME '15m'
|
||||||
|
echo " proxy_pass http://localhost:${MAILPILE_PORT}/;" >> $mailpile_nginx_site
|
||||||
|
echo ' proxy_set_header X-Forwarded-Host $host;' >> $mailpile_nginx_site
|
||||||
|
echo ' proxy_set_header X-Forwarded-Server $host;' >> $mailpile_nginx_site
|
||||||
|
echo ' proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;' >> $mailpile_nginx_site
|
||||||
|
echo ' }' >> $mailpile_nginx_site
|
||||||
|
echo '}' >> $mailpile_nginx_site
|
||||||
|
|
||||||
function_check create_site_certificate
|
function_check create_site_certificate
|
||||||
if [ ! -f /etc/ssl/certs/${MAILPILE_DOMAIN_NAME}.pem ]; then
|
if [ ! -f /etc/ssl/certs/${MAILPILE_DOMAIN_NAME}.pem ]; then
|
||||||
|
|
Loading…
Reference in New Issue