question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

502 Bad Gateway - Clean installation using installer on a fresh Debian 9.4. No other errors.

See original GitHub issue

Impacted versions

  • Modoboa: 1.10.4 (latest)
  • installer used: Yes
  • Webserver: Nginx
  • OS: Latest Debian 9.4

Steps to reproduce

apt-get update
apt-get -y dist-upgrade
apt-get -y install python-virtualenv python-pip git sudo
git clone https://github.com/modoboa/modoboa-installer
cd modoboa-installer
sudo ./run.py hostname.domain.tld [enter: n]
In file: installer.cfg change from: hostname = mail.%(domain)s to: hostname = %(domain)s
sudo ./run.py hostname.domain.tld [enter: y]

Output:

root@hostname:~/modoboa-installer# sudo ./run.py hostname.domain.tld Welcome to Modoboa installer!

Configuration file installer.cfg not found, creating new one. Warning: Before you start the installation, please make sure the following DNS records exist for domain ‘hostname.domain.tld’: mail IN A <IP ADDRESS OF YOUR SERVER> IN MX mail.hostname.domain.tld.

Your mail server will be installed with the following components: modoboa automx amavis clamav dovecot nginx razor postfix postwhite spamassassin uwsgi radicale opendkim Do you confirm? (Y/n) n root@hostname:~/modoboa-installer# nano installer.cfg root@hostname:~/modoboa-installer# sudo ./run.py hostname.domain.tld Welcome to Modoboa installer!

Warning: Before you start the installation, please make sure the following DNS records exist for domain ‘hostname.domain.tld’: mail IN A <IP ADDRESS OF YOUR SERVER> IN MX hostname.domain.tld.

Your mail server will be installed with the following components: modoboa automx amavis clamav dovecot nginx razor postfix postwhite spamassassin uwsgi radicale opendkim Do you confirm? (Y/n) y The process can be long, feel free to take a coffee and come back later 😉 Starting… Generating new self-signed certificate Installing amavis Installing spamassassin Installing razor Installing clamav Installing modoboa Installing automx Installing radicale Installing uwsgi Installing nginx Installing opendkim Installing postfix Installing postwhite Installing dovecot Congratulations! You can enjoy Modoboa at https://hostname.domain.tld (admin:password)

Current behavior

When I open: https://hostname.domain.tld i get this error:

502 Bad Gateway nginx/1.10.3

Logs: /var/log/nginx/hostname.domain.tld-error.log

2018/05/03 12:13:43 [error] 738#738: *4 upstream prematurely closed connection while reading response header from upstream, client: x.x.x.x, server: hostname.domain.tld, request: “GET / HTTP/1.1”, upstream: “uwsgi://unix:/run/uwsgi/app/modoboa_instance/socket:”, host: “hostname.domain.tld”

/var/log/uwsgi/app/modoboa_instance.log

Traceback (most recent call last): File “/srv/modoboa/env/local/lib/python2.7/site-packages/django/core/handlers/wsgi.py”, line 157, in call File “/srv/modoboa/env/local/lib/python2.7/site-packages/django/core/handlers/base.py”, line 124, in get_response File “/srv/modoboa/env/local/lib/python2.7/site-packages/django/core/handlers/exception.py”, line 43, in inner File “/srv/modoboa/env/local/lib/python2.7/site-packages/django/core/handlers/exception.py”, line 93, in response_for_exception File “/srv/modoboa/env/local/lib/python2.7/site-packages/django/core/handlers/exception.py”, line 142, in handle_uncaught_exception File “/srv/modoboa/env/local/lib/python2.7/site-packages/django/urls/resolvers.py”, line 418, in resolve_error_handler File “/srv/modoboa/env/local/lib/python2.7/site-packages/django/utils/functional.py”, line 35, in get File “/srv/modoboa/env/local/lib/python2.7/site-packages/django/urls/resolvers.py”, line 398, in urlconf_module File “/usr/lib/python2.7/importlib/init.py”, line 37, in import_module import(name) File “./instance/urls.py”, line 4, in <module> url(r’‘, include(‘modoboa.urls’)), File “/srv/modoboa/env/local/lib/python2.7/site-packages/django/conf/urls/init.py”, line 50, in include File “/usr/lib/python2.7/importlib/init.py”, line 37, in import_module import(name) ImportError: No module named urls hostname.domain.tld [pid: 1391|app: 1|req: 11/21] x.x.x.x () {52 vars in 921 bytes} [Thu May 3 14:27:05 2018] GET / => generated 0 bytes in 211 msecs (HTTP/1.1 500) 0 headers in 0 bytes (1 switches on core 0) Traceback (most recent call last): File “/srv/modoboa/env/local/lib/python2.7/site-packages/django/core/handlers/wsgi.py”, line 157, in call File “/srv/modoboa/env/local/lib/python2.7/site-packages/django/core/handlers/base.py”, line 124, in get_response File “/srv/modoboa/env/local/lib/python2.7/site-packages/django/core/handlers/exception.py”, line 43, in inner File “/srv/modoboa/env/local/lib/python2.7/site-packages/django/core/handlers/exception.py”, line 93, in response_for_exception File “/srv/modoboa/env/local/lib/python2.7/site-packages/django/core/handlers/exception.py”, line 142, in handle_uncaught_exception File “/srv/modoboa/env/local/lib/python2.7/site-packages/django/urls/resolvers.py”, line 418, in resolve_error_handler File “/srv/modoboa/env/local/lib/python2.7/site-packages/django/utils/functional.py”, line 35, in get File “/srv/modoboa/env/local/lib/python2.7/site-packages/django/urls/resolvers.py”, line 398, in urlconf_module File “/usr/lib/python2.7/importlib/init.py”, line 37, in import_module import(name) File “./instance/urls.py”, line 4, in <module> url(r’', include(‘modoboa.urls’)), File “/srv/modoboa/env/local/lib/python2.7/site-packages/django/conf/urls/init.py”, line 50, in include File “/usr/lib/python2.7/importlib/init.py”, line 37, in import_module import(name) ImportError: No module named urls hostname.domain.tld [pid: 1392|app: 1|req: 11/22] x.x.x.x () {54 vars in 926 bytes} [Thu May 3 14:27:06 2018] GET /favicon.ico => generated 0 bytes in 90 msecs (HTTP/1.1 500) 0 headers in 0 bytes (0 switches on core 0)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:18 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
tonioocommented, May 9, 2018

@desavil I wont reproduce your installation, I don’t have time for this. Anyway, I misread the issue’s description: your initial command line was wrong. Do not pass hostname.domain.tld as first argument but just domain.tld.

1reaction
xGruntxcommented, May 9, 2018

@desavil It’s problem in installer https://github.com/modoboa/modoboa-installer/issues/197#issuecomment-385621392 . Workaround is working , but dkim is not . After third reinstall - actually, I’m beat. Doing the same manually i’ve lost less time .

Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Fix a 502 Bad Gateway Error - Kinsta
The 502 bad gateway error specifically means that server received an invalid response from an inbound server. Check out these common causes ...
Read more >
502 Bad Gateway - Questions : Graphite - Launchpad Answers
Hi all, I'm on Debian 9.4 and I'm following the installation guide step by ... I'm using the nginx + gunicorn and again...
Read more >
#998705 - Many 502 errors, when using apt-cacher-ng for ...
While this works fine, when - for example - I install only the standard task ... the installation fails due to many 502...
Read more >
502 Bad Gateway Error [Solved] - freeCodeCamp
The causes of the 502 bad gateway error include an overloaded server, an error in the code, and yet-to-be-propagated domain names. So the...
Read more >
Why does yum return error: [Errno 256] No more mirrors to try
Check the network connectivity. If IP based Firewall is being used then whitelist the IPs that are mentioned in Public CIDR Lists for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found