modoboa / modoboa-installer

An installer for Modoboa
MIT License
255 stars 136 forks source link

Web panel gives 502 bad gateway after install #201

Closed wUFr closed 6 years ago

wUFr commented 6 years ago

Impacted versions

problems that occured during installation which i had to fix: (probably not related to this issue, just to point it out)

finally after all, nginx is now running, but when trying to access admin panel, i just get 502 error...

From nginx error log:

2018/04/07 19:19:22 [error] 22551#0: *1 upstream prematurely closed connection while reading response header from upstream$

tried some solutions, but i dont know anymore, tried to reinstall too :'(

nethoncho commented 6 years ago

Same issue here

I had to run LetsEncrypt manually also. Got it working with nginx

2018/04/07 17:41:50 [error] 3641#3641: *1 upstream prematurely closed connection while reading response header from upstream,
wUFr commented 6 years ago

looks like something is running in back-end, cuz few "modoboa" processes go 100% CPU every minute

cpu

processes

wUFr commented 6 years ago

Some errors that pop in during installation

Traceback (most recent call last):
  File "/srv/modoboa/instance/manage.py", line 22, in <module>
    execute_from_command_line(sys.argv)
  File "/srv/modoboa/env/lib/python2.7/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
    utility.execute()
  File "/srv/modoboa/env/lib/python2.7/site-packages/django/core/management/__init__.py", line 341, in execute
    django.setup()
  File "/srv/modoboa/env/lib/python2.7/site-packages/django/__init__.py", line 27, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/srv/modoboa/env/lib/python2.7/site-packages/django/apps/registry.py", line 115, in populate
    app_config.ready()
  File "/srv/modoboa/env/lib/python2.7/site-packages/modoboa_amavis/apps.py", line 19, in ready
    from . import handlers  # NOQA:F401
  File "/srv/modoboa/env/lib/python2.7/site-packages/modoboa_amavis/handlers.py", line 17, in <module>
    from . import forms
  File "/srv/modoboa/env/lib/python2.7/site-packages/modoboa_amavis/forms.py", line 17, in <module>
    class DomainPolicyForm(forms.ModelForm):
  File "/srv/modoboa/env/lib/python2.7/site-packages/modoboa_amavis/forms.py", line 21, in DomainPolicyForm
    class Meta:
  File "/srv/modoboa/env/lib/python2.7/site-packages/modoboa_amavis/forms.py", line 27, in Meta
    "bypass_virus_checks": form_utils.HorizontalRadioSelect(),
AttributeError: 'module' object has no attribute 'HorizontalRadioSelect'
tonioo commented 6 years ago

Duplicate of #197

wUFr commented 6 years ago

issue persists, still a lot of python errors with ImportError: No module named backports at the end during installation

example:

['/srv/modoboa/env/bin/python', u'manage.py', u'load_initial_data', u'--admin-username', u'admin'] failed, check your configuration
Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    execute_from_command_line(sys.argv)
  File "/srv/modoboa/env/lib/python2.7/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
    utility.execute()
  File "/srv/modoboa/env/lib/python2.7/site-packages/django/core/management/__init__.py", line 356, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/srv/modoboa/env/lib/python2.7/site-packages/django/core/management/base.py", line 283, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/srv/modoboa/env/lib/python2.7/site-packages/django/core/management/base.py", line 327, in execute
    self.check()
  File "/srv/modoboa/env/lib/python2.7/site-packages/django/core/management/base.py", line 359, in check
    include_deployment_checks=include_deployment_checks,
  File "/srv/modoboa/env/lib/python2.7/site-packages/django/core/management/base.py", line 346, in _run_checks
    return checks.run_checks(**kwargs)
  File "/srv/modoboa/env/lib/python2.7/site-packages/django/core/checks/registry.py", line 81, in run_checks
    new_errors = check(app_configs=app_configs)
  File "/srv/modoboa/env/lib/python2.7/site-packages/django/core/checks/urls.py", line 16, in check_url_config
    return check_resolver(resolver)
  File "/srv/modoboa/env/lib/python2.7/site-packages/django/core/checks/urls.py", line 26, in check_resolver
    return check_method()
  File "/srv/modoboa/env/lib/python2.7/site-packages/django/urls/resolvers.py", line 254, in check
    for pattern in self.url_patterns:
  File "/srv/modoboa/env/lib/python2.7/site-packages/django/utils/functional.py", line 35, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/srv/modoboa/env/lib/python2.7/site-packages/django/urls/resolvers.py", line 405, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/srv/modoboa/env/lib/python2.7/site-packages/django/utils/functional.py", line 35, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/srv/modoboa/env/lib/python2.7/site-packages/django/urls/resolvers.py", line 398, in urlconf_module
    return import_module(self.urlconf_name)
  File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/srv/modoboa/instance/instance/urls.py", line 4, in <module>
    url(r'', include('modoboa.urls')),
  File "/srv/modoboa/env/lib/python2.7/site-packages/django/conf/urls/__init__.py", line 50, in include
    urlconf_module = import_module(urlconf_module)
  File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/srv/modoboa/env/lib/python2.7/site-packages/modoboa/urls.py", line 31, in <module>
    url("admin/", include("modoboa.admin.urls", namespace="admin")),
  File "/srv/modoboa/env/lib/python2.7/site-packages/django/conf/urls/__init__.py", line 50, in include
    urlconf_module = import_module(urlconf_module)
  File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/srv/modoboa/env/lib/python2.7/site-packages/modoboa/admin/urls.py", line 10, in <module>
    from .views import (
  File "/srv/modoboa/env/lib/python2.7/site-packages/modoboa/admin/views/export.py", line 22, in <module>
    from backports import csv
ImportError: No module named backports
tonioo commented 6 years ago

@wUFr Either try a fresh install (on a clean system) or remove the virtualenv before restarting the installer:

rm -r /srv/modoboa/env
rm -r /srv/modoboa/.cache/pip
wUFr commented 6 years ago

that fixed it, please consider adding this tip on website too (:

Opizol commented 5 years ago

Whatever I try to do, 502 Bad Gateway will be displayed permanently. Please help me! NGINX error: upstream prematurely closed connection while reading response header from upstream, client: 192.168.1.100, server: mail.test.com, request: "GET /favicon.ico HTTP/1.1", upstream: "uwsgi://unix:/run/uwsgi/modoboa_instance.sock:", host: "mail.test.com"

Thanks

OPO

AncalagonTheBlack commented 5 years ago

Whatever I try to do, 502 Bad Gateway will be displayed permanently. Please help me! NGINX error: upstream prematurely closed connection while reading response header from upstream, client: 192.168.1.100, server: mail.test.com, request: "GET /favicon.ico HTTP/1.1", upstream: "uwsgi://unix:/run/uwsgi/modoboa_instance.sock:", host: "mail.test.com"

Thanks

OPO

I have the same problem. Any Idea ? And also this bug doesnt seem new. I think modoboa isnt production ready.

tonioo commented 5 years ago

I fixed a bug recently about this: https://github.com/modoboa/modoboa-installer/commit/3bcd8c172ff1d90141fdda3d05f1b32c5a03c9d9.

AncalagonTheBlack commented 5 years ago

I see. But this bug also happens on debian 9. Should i open a new issue about that ?

tonioo commented 5 years ago

@AncalagonTheBlack Yes, with a full trace using the --debug option please.

dasilvaca commented 8 months ago

Hi there! I encounter is about some SE Linux policies related to nginx.

You can check your auditlogs, identify which policies are restricting the port to be accessed (or just use grep to check nginx blocks), identify your auditlog message id and use audit2allow for keeping instructions to be applied by semodule.

sudo grep avc /var/log/audit/audit.log
sudo grep ${message_id_on_auditlog} /var/log/audit/audit.log | sudo audit2allow -M nginx_allow_t
sudo semodule -i nginx_allow_t.pp