Closed BetaJoshy closed 5 years ago
I've edited this post to correct formatting errors, which swallowed most of the configuration.
@BetaJoshy Did you do anything to Mailcow's nginx configuration? Your Apache configuration looks fine at first glance. Did you run docker-compose up -d
after changing mailcow.conf
? Which Apache version do you use?
@hachre
Thanks for editing.
I did not change anything to the NGINX conf.
In the Mailcow.conf I changed the above listet Ports and Binds... nothing else
After I changed the mailcow.conf I runned the command. docker-compose up -d
Do I have to change anything in the NGINX conf?
Thank you for your help
Maybe it is interesting, that I use the certbot for my other webistes, too?
I noticed you using your own certbot, but that shouldn't matter for this issue. No, you shouldn't have to edit the Mailcow nginx configuration at all, was just making sure you hadn't.
I suspect the problem isn't with your Apache setup, but something in Mailcow not working correctly on your machine.
Are you running any firewall? Maybe the default ufw
from Ubuntu? If there's a firewall, it can cause problems with the multiple Mailcow docker containers communicating with each other and it could cause a nginx error like that.
If you have ufw (or another firewall) running, you can try:
ufw disable
docker-compose down
iptables -F
systemctl restart docker
docker-compose up -d
If this still results in the nginx gateway error, try the following to narrow it down:
docker-compose down
systemctl restart docker
docker-compose up -d
Now check if you can successfully reach the Mailcow UI. If you still get the nginx error now, there must be another problem and it is not related to your Apache setup.
Once you've tried both my suggestions and if there's still no change, we will need logfiles. Access the Mailcow UI, so you get to see the nginx error and then get the latest nginx and php logs by running:
docker-compose logs --tail=50 nginx-mailcow
docker-compose logs --tail=50 php-fpm-mailcow
and post them here. Thanks!
@hachre Thank you very much for your help.
When I'm back from work, I will try this immediately!
@hachre Hi, I just tried your first suggestion. When I enter the command docker-compose down
I will get the Error:
WARNING: The WATCHDOG_NOTIFY_EMAIL variable is not set. Defaulting to a blank string. ERROR: An HTTP request took too long to complete. Retry with --verbose to obtain debug information. If you encounter this issue regularly because of slow network conditions, consider setting COMPOSE_HTTP_TIMEOUT to a higher value (current value: 60).
The server is very slow or under high load. :/
@andryyy There shouldn't be a probem. Ive got 1000 Mbits, six cores + SSD and 16 GB RAM. Mh is there any fix for this?
With those specs, this error is very unusual indeed. How many processes are running? How much RAM is free? Is there any SWAP in use? Is the SWAP on SSD as well?
Server reboot might be necessary at this point.
If it's a 5€ VPS I guarantee you share all of these resources with at least 100 other VPS on that node. Don't fall for this.
Otherwise your Docker daemon might be stuck. Try to restart the service or the server itself.
@hachre @andryyy I rebooted and now it worked. Sorry for the issue.
So I tried both of your Options @hachre ... Nothing changed same Error:
502 Bad Gateway nginx
So I will Pull the Logs now and send you it :)
docker-compose logs --tail=50 nginx-mailcow
WARNING: The WATCHDOG_NOTIFY_EMAIL variable is not set. Defaulting to a blank string.
Attaching to mailcowdockerized_nginx-mailcow_1
nginx-mailcow_1 | 2019/03/18 16:28:05 [emerg] 12#12: host not found in upstream "rspamd" in /etc/nginx/conf.d/site.conf:114
nginx-mailcow_1 | nginx: [emerg] host not found in upstream "rspamd" in /etc/nginx/conf.d/site.conf:114
nginx-mailcow_1 | nginx: configuration file /etc/nginx/nginx.conf test failed
nginx-mailcow_1 | 2019/03/18 16:28:15 [error] 16#16: *2 connect() failed (111: Connection refused) while connecting to upstream, client: fd4d:6169:6c63:6f77::1, server: _, request: "HEAD /settings.php HTTP/1.1", upstream: "fastcgi://172.22.1.10:9001", host: "ng inx"
nginx-mailcow_1 | 2019/03/18 16:28:15 [error] 16#16: *4 connect() failed (111: Connection refused) while connecting to upstream, client: fd4d:6169:6c63:6f77::1, server: _, request: "HEAD /forwardinghosts.php HTTP/1.1", upstream: "fastcgi://[fd4d:6169:6c63:6f77: :d]:9001", host: "nginx"
nginx-mailcow_1 | 2019/03/18 16:28:15 [error] 16#16: *4 no live upstreams while connecting to upstream, client: fd4d:6169:6c63:6 f77::1, server: _, request: "HEAD /forwardinghosts.php HTTP/1.1", upstream: "fastcgi://phpfpm", host: "nginx"
nginx-mailcow_1 | fd4d:6169:6c63:6f77::1 - - [18/Mar/2019:16:28:15 +0100] "HEAD /forwardinghosts.php HTTP/1.1" 502 0 "-" "rspamd -1.9.0"
nginx-mailcow_1 | 2019/03/18 16:28:15 [error] 16#16: *2 connect() failed (111: Connection refused) while connecting to upstream, client: fd4d:6169:6c63:6f77::1, server: _, request: "HEAD /settings.php HTTP/1.1", upstream: "fastcgi://[fd4d:6169:6c63:6f77::d]:900 1", host: "nginx"
nginx-mailcow_1 | fd4d:6169:6c63:6f77::1 - - [18/Mar/2019:16:28:15 +0100] "HEAD /settings.php HTTP/1.1" 502 0 "-" "rspamd-1.9.0"
nginx-mailcow_1 | 2019/03/18 16:28:17 [error] 16#16: *8 connect() failed (111: Connection refused) while connecting to upstream, client: xxx, server: mail.xxx.network, request: "GET / HTTP/2.0", upstream: "fastcgi://172.22.1.10:9002", host: "mail.b etas.network"
nginx-mailcow_1 | 2019/03/18 16:28:17 [error] 16#16: *8 connect() failed (111: Connection refused) while connecting to upstream, client: xxx, server: mail.xxx.network, request: "GET / HTTP/2.0", upstream: "fastcgi://[fd4d:6169:6c63:6f77::d]:9002", host: "mail.xxx.network"
nginx-mailcow_1 | xxx- - [18/Mar/2019:16:28:17 +0100] "GET / HTTP/2.0" 502 552 "-" "Mozilla/5.0 (Windows NT 10.0; Wi n64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.75 Safari/537.36"
nginx-mailcow_1 | 2019/03/18 16:28:19 [error] 16#16: *8 no live upstreams while connecting to upstream, client: xxx, server: mail.xxx.network, request: "GET / HTTP/2.0", upstream: "fastcgi://phpfpm", host: "mail.xxx.network"
nginx-mailcow_1 | xxx- - [18/Mar/2019:16:28:19 +0100] "GET / HTTP/2.0" 502 552 "-" "Mozilla/5.0 (Windows NT 10.0; Wi n64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.75 Safari/537.36"
nginx-mailcow_1 | xxx- - [18/Mar/2019:16:28:19 +0100] "GET /favicon.ico HTTP/2.0" 404 167 "https://mail.xxx.networ k/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.75 Safari/537.36"
nginx-mailcow_1 | xxx- - [18/Mar/2019:16:28:21 +0100] "GET / HTTP/1.1" 502 552 "-" "Mozilla/5.0 (Windows NT 10.0; Wi n64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.75 Safari/537.36"
nginx-mailcow_1 | 2019/03/18 16:28:21 [error] 16#16: *13 no live upstreams while connecting to upstream, client: xxx, server: mail.xxx.network, request: "GET / HTTP/1.1", upstream: "fastcgi://phpfpm", host: "xxx.network"
nginx-mailcow_1 | xxx- - [18/Mar/2019:16:28:21 +0100] "GET /favicon.ico HTTP/1.1" 404 178 "http://xxx.network/" "M ozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.75 Safari/537.36"
nginx-mailcow_1 | 66.249.64.127 - - [18/Mar/2019:16:30:07 +0100] "GET /Ranksystem/stats/list_rankup.php?sort=lastseen&order=asc& seite=1&user=0&search=filter:lastseen:%3E:1534065072: HTTP/1.1" 404 178 "-" "Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5X Build/MMB29P ) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.96 Mobile Safari/537.36 (compatible; Googlebot/2.1; +http://www.google.com/ bot.html)"
docker-compose logs --tail=50 php-fpm-mailcow
WARNING: The WATCHDOG_NOTIFY_EMAIL variable is not set. Defaulting to a blank string.
Attaching to mailcowdockerized_php-fpm-mailcow_1
php-fpm-mailcow_1 | Waiting for SQL...
php-fpm-mailcow_1 | Waiting for SQL...
php-fpm-mailcow_1 | Waiting for SQL...
php-fpm-mailcow_1 | Waiting for SQL...
php-fpm-mailcow_1 | Waiting for SQL...
php-fpm-mailcow_1 | Waiting for SQL...
php-fpm-mailcow_1 | Waiting for SQL...
php-fpm-mailcow_1 | Waiting for SQL...
php-fpm-mailcow_1 | Waiting for SQL...
php-fpm-mailcow_1 | Waiting for SQL...
php-fpm-mailcow_1 | Waiting for SQL...
php-fpm-mailcow_1 | Waiting for SQL...
php-fpm-mailcow_1 | Waiting for SQL...
php-fpm-mailcow_1 | Waiting for SQL...
php-fpm-mailcow_1 | Waiting for SQL...
php-fpm-mailcow_1 | Waiting for SQL...
php-fpm-mailcow_1 | Waiting for SQL...
php-fpm-mailcow_1 | Waiting for SQL...
php-fpm-mailcow_1 | Waiting for SQL...
php-fpm-mailcow_1 | Waiting for SQL...
php-fpm-mailcow_1 | Waiting for SQL...
php-fpm-mailcow_1 | Waiting for SQL...
php-fpm-mailcow_1 | Waiting for SQL...
php-fpm-mailcow_1 | Waiting for SQL...
php-fpm-mailcow_1 | Waiting for SQL...
php-fpm-mailcow_1 | Waiting for SQL...
php-fpm-mailcow_1 | Waiting for SQL...
php-fpm-mailcow_1 | Waiting for SQL...
php-fpm-mailcow_1 | Waiting for SQL...
php-fpm-mailcow_1 | Waiting for SQL...
php-fpm-mailcow_1 | Waiting for SQL...
php-fpm-mailcow_1 | Waiting for SQL...
php-fpm-mailcow_1 | Waiting for SQL...
php-fpm-mailcow_1 | Waiting for SQL...
php-fpm-mailcow_1 | Waiting for SQL...
php-fpm-mailcow_1 | Waiting for SQL...
php-fpm-mailcow_1 | Waiting for SQL...
php-fpm-mailcow_1 | Waiting for SQL...
php-fpm-mailcow_1 | Waiting for SQL...
php-fpm-mailcow_1 | Waiting for SQL...
php-fpm-mailcow_1 | Waiting for SQL...
php-fpm-mailcow_1 | Waiting for SQL...
php-fpm-mailcow_1 | Waiting for SQL...
php-fpm-mailcow_1 | Waiting for SQL...
php-fpm-mailcow_1 | Waiting for SQL...
php-fpm-mailcow_1 | Waiting for SQL...
php-fpm-mailcow_1 | Waiting for SQL...
php-fpm-mailcow_1 | Waiting for SQL...
php-fpm-mailcow_1 | Waiting for SQL...
php-fpm-mailcow_1 | Waiting for SQL...
Okay, so then we'll need the SQL logs as well:
docker-compose logs --tail=1000 mysql-mailcow
docker-compose logs --tail=1000 mysql-mailcow
WARNING: The WATCHDOG_NOTIFY_EMAIL variable is not set. Defaulting to a blank string.
Attaching to mailcowdockerized_mysql-mailcow_1
mysql-mailcow_1 | 2019-03-18 16:28:00 140297144559552 [Note] mysqld (mysqld 10.2.22-MariaDB-1:10.2.22+maria~bionic) starting as process 1 ...
mysql-mailcow_1 | 2019-03-18 16:28:00 140297144559552 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
mysql-mailcow_1 | 2019-03-18 16:28:00 140297144559552 [Note] InnoDB: Uses event mutexes
mysql-mailcow_1 | 2019-03-18 16:28:00 140297144559552 [Note] InnoDB: Compressed tables use zlib 1.2.11
mysql-mailcow_1 | 2019-03-18 16:28:00 140297144559552 [Note] InnoDB: Using Linux native AIO
mysql-mailcow_1 | 2019-03-18 16:28:00 140297144559552 [Note] InnoDB: Number of pools: 1
mysql-mailcow_1 | 2019-03-18 16:28:00 140297144559552 [Note] InnoDB: Using SSE2 crc32 instructions
mysql-mailcow_1 | 2019-03-18 16:28:00 140297144559552 [Note] InnoDB: Initializing buffer pool, total size = 256M, instances = 1, chunk size = 128M
mysql-mailcow_1 | 2019-03-18 16:28:00 140297144559552 [Note] InnoDB: Completed initialization of buffer pool
mysql-mailcow_1 | 2019-03-18 16:28:00 140296418662144 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
mysql-mailcow_1 | 2019-03-18 16:28:00 140297144559552 [Note] InnoDB: Highest supported file format is Barracuda.
mysql-mailcow_1 | 2019-03-18 16:28:01 140297144559552 [Note] InnoDB: 128 out of 128 rollback segments are active.
mysql-mailcow_1 | 2019-03-18 16:28:01 140297144559552 [Note] InnoDB: Creating shared tablespace for temporary tables
mysql-mailcow_1 | 2019-03-18 16:28:01 140297144559552 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
mysql-mailcow_1 | 2019-03-18 16:28:01 140297144559552 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
mysql-mailcow_1 | 2019-03-18 16:28:01 140297144559552 [Note] InnoDB: Waiting for purge to start
mysql-mailcow_1 | 2019-03-18 16:28:01 140297144559552 [Note] InnoDB: 5.7.25 started; log sequence number 2489593
mysql-mailcow_1 | 2019-03-18 16:28:01 140295844919040 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
mysql-mailcow_1 | 2019-03-18 16:28:01 140297144559552 [Note] Server socket created on IP: '::'.
mysql-mailcow_1 | 2019-03-18 16:28:01 140297144559552 [Warning] 'proxies_priv' entry '@% root@c711dc460c58' ignored in --skip-name-resolve mod e.
mysql-mailcow_1 | 2019-03-18 16:28:01 140296854128384 [Note] Event Scheduler: scheduler thread started with id 6
mysql-mailcow_1 | 2019-03-18 16:28:01 140297144559552 [Note] mysqld: ready for connections.
mysql-mailcow_1 | Version: '10.2.22-MariaDB-1:10.2.22+maria~bionic' socket: '/var/run/mysqld/mysqld.sock' port: 3306 mariadb.org binary dis tribution
mysql-mailcow_1 | 2019-03-18 16:28:02 140295844919040 [Note] InnoDB: Buffer pool(s) load completed at 190318 16:28:02
Does your mailcow.conf
contain the DBNAME, DBUSER, DBPASS and DBROOT variables and are they set correctly? Is it possible you edited those out by accident during your editing of other values?
Please run:
source mailcow.conf
docker-compose exec php-fpm-mailcow mysqladmin status --socket=/var/run/mysqld/mysqld.sock -u${DBUSER} -p${DBPASS}
What does this command return?
@hachre
WARNING: The WATCHDOG_NOTIFY_EMAIL variable is not set. Defaulting to a blank string.
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'mailcow'@'localhost' (using password: YES)'
I thought I will change it, when I configurate Mailcow in the browser
No, when you first run ./generate_config.sh
, it configures MySQL with generated values for those variables. After they are generated, they mustn't be changed in the mailcow.conf
, or you lose access to MySQL. It seems this is what happened here.
Your Mailcow is empty right? Hasn't been used yet? In that case, I'd suggest you erase MySQL, your mailcow.conf
and re-run ./generate_config.sh
.
@hachre could you please tell me where I can erase my MySQL?... Sorry for this stupid question.
No problem, I forgot that part. There's certainly a more elegant way of doing this, but my way is:
docker-compose down
systemctl stop docker
rm -R /var/lib/docker/volumes/mailcowdockerized_mysql-vol-1/_data/*
systemctl start docker
rm mailcow.conf
./generate_config.sh
docker-compose up -d
@hachre
done that... Still same error.
I'm very wondered, because when I installed mailcow-dockerized for first time it worked. I startet the error after I tried the reverse proxy.
Mhh...
But before we continue I really want to say thank you, that you help me this much! ♥
Which error is still the same? Repeating the command from https://github.com/mailcow/mailcow-dockerized/issues/2445#issuecomment-473967839 still gives the same result?
@hachre Sorry. No the command from https://github.com/mailcow/mailcow-dockerized/issues/2445#issuecomment-473967839 get out:
WARNING: The WATCHDOG_NOTIFY_EMAIL variable is not set. Defaulting to a blank string.
Uptime: 418 Threads: 29 Questions: 738 Slow queries: 0 Opens: 103 Flush tables: 1 Open tables: 60 Queries per second avg: 1.765
With the same error I ment the 502 Bad Gateway nginx error
Well at least there's progress now! Did you change the mailcow.conf
to set up the HTTP/HTTPS IP to 127.0.0.1 and the ports?
No I did nothing with it.
Okay, edit it to your original values:
HTTP_BIND=127.0.0.1
HTTP_PORT=8080
HTTPS_BIND=127.0.0.1
HTTPS_PORT=8443
but change nothing else.
When you're finished run docker-compose up -d
and try it out!
@hachre Should I start apache now?
Oh, yes - I assumed that had been running all along since our test back then. Sorry!
IT WORK!!!! Thank you ♥
👍👍👍
You're very welcome! :)
I have a related question that, following the directions here, isn't solved. Except I get error 500
apache virtual host mailcow.conf file
`<VirtualHost *:80>
ServerName mail.example.com
ServerAlias autodiscover.example.com
ServerAlias autoconfig.example.com
RewriteEngine On
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
ProxyPass / http://127.0.0.1:8080/
ProxyPassReverse / http://127.0.0.1:8080/
ProxyPreserveHost On
ProxyAddHeaders On
</VirtualHost>
<VirtualHost *:443>
ServerName mail.example.com
ServerAlias autodiscover.example.com
ServerAlias autoconfig.example.com
ProxyPass / http://127.0.0.1:8080/
ProxyPassReverse / http://127.0.0.1:8080/
ProxyPreserveHost On
ProxyAddHeaders On
RequestHeader set X-Forwarded-Proto "https"
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
</VirtualHost>`
mail-cow.conf port binds
`HTTP_PORT=8080
HTTP_BIND=127.0.0.1
HTTPS_PORT=8443
HTTPS_BIND=127.0.0.1`
I have a related question that, following the directions here, isn't solved. Except I get error 500
apache virtual host mailcow.conf file
`<VirtualHost *:80> ServerName mail.example.com ServerAlias autodiscover.example.com ServerAlias autoconfig.example.com RewriteEngine On RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L] ProxyPass / http://127.0.0.1:8080/ ProxyPassReverse / http://127.0.0.1:8080/ ProxyPreserveHost On ProxyAddHeaders On </VirtualHost> <VirtualHost *:443> ServerName mail.example.com ServerAlias autodiscover.example.com ServerAlias autoconfig.example.com ProxyPass / http://127.0.0.1:8080/ ProxyPassReverse / http://127.0.0.1:8080/ ProxyPreserveHost On ProxyAddHeaders On RequestHeader set X-Forwarded-Proto "https" Include /etc/letsencrypt/options-ssl-apache.conf SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem </VirtualHost>`
mail-cow.conf port binds
`HTTP_PORT=8080 HTTP_BIND=127.0.0.1 HTTPS_PORT=8443 HTTPS_BIND=127.0.0.1`
Nevermind!! Simply looking at the right log fixed it for me! I needed to
a2enmod proxy_http
Hello friends!
Ive got a big problem with my mailcow-dockerized.
I installed mailcow and stopped apache before I done it. Everything worked fine.
But I want to host a webserver, too... and for this I use apache.
Now I started to create a reversed proxy, but evrything I tried don't work.
I use Ubuntu 18.10. My Server is a V-Server.
I already changed the Mailcow.conf:
and set a apache conf data:
now when i open the website: mail.xxx.network
I get the Error:
502 Bad Gateway nginx