1 (edited by graabein 2016-04-24 21:14:34)

Topic: IredMail wreck my website

======== Required information ====
- iRedMail version (check /etc/iredmail-release): 0.9.4
- Linux/BSD distribution name and version: Ubuntu 14.04
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx): Apache 2 (apache2-mpm-prefork)
- Manage mail accounts with iRedAdmin-Pro? No
- Related log if you're reporting an issue: Have no log because had to revert to working snapshot to serve existing users on the main website, which became non-working when trying to install IredMail.
====

Hi ZhangHuangbin

I very much appreciate your IredMail, and have it installed on a couple of websites, working well

However, I have a special server where I have installed Booktype from http://sourcefabric.org.  Booktype is installed using an automated install, that creates a document root /var/www/booktype.  And it is difficult to change this in order to have it installed in /var/www/html.  In this Booktype installation I have several books, and several users, so I can NOT start installing IredMail on a fresh Ubuntu droplet, I have to install it on the existing one.

When I followed your installguide for Ubuntu/Debian, after configuring the /etc/host and /etc/hostname files as suggested, then IredMail works as expected, but the Booktype installation gives apache server error.

Booktype is configured to be served by the root domain: example.com:80
Pointing to /var/www/booktype

After installing IredMail the root domain redirects to https://example.com/mail

For problem solving, I a2dissite default-ssl.conf to see if domain then will resolve to my Booktype installation, which it does, but now with the above mentioned server error.

The booktype installation is a simple <VirtualHost *:80> with the following virtual host configuration:

<VirtualHost *:80>

     # Change the following three lines for your server

     ServerName example.com
     ServerAlias www.example.com
     SetEnv HTTP_HOST "example.com"
     ServerAdmin root@localhost

     SetEnv LC_TIME "en_GB.UTF-8"
     SetEnv LANG "en_GB.UTF-8"

     WSGIScriptAlias / /var/www/booktype/instance1/instance1_site/wsgi.py

     # uncomment 'Require all granted' for Apache 2.4 without mod_access_compat

     <Location "/">
       Require all granted
       Options FollowSymLinks
     </Location>

     Alias /static/ "/var/www/booktype/instance1/static/"
     <Directory "/var/www/booktype/instance1/static/">
       Require all granted
       Options -Indexes
     </Directory>

     Alias /data/ "/var/www/booktype/instance1/data/"
     <Directory "/var/www/booktype/instance1/data/">
       Require all granted
       Options -Indexes
     </Directory>

     ErrorLog ${APACHE_LOG_DIR}/booktype-instance1-error.log
     LogLevel warn
     CustomLog ${APACHE_LOG_DIR}/booktype-instance1-access.log combined
</VirtualHost>

I just wonder, what on earth do the IredMail installation do, that can wreck this previos Booktype installation?  I understand the default-ssl.conf file rules the day by default, but this should not create a server ERROR on the Booktype site, specially when I also a2dissite default-ssl.conf

I am sorry I don't have any error logs to display, but if you absolutely need it in order to point me in the right direction to solve the problem, then I can reinstall iRedMail and dig out the error logs.  Just hoped I could avoid it, in order to not distrupt the ongoing working Booktype website.

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: IredMail wreck my website

*) As clearly mentioned in iRedMail installation guide, iRedMail requires a fresh server. you were warned.
*) We cannot help much without related error/log... Sorry.

3 (edited by graabein 2016-04-24 21:41:14)

Re: IredMail wreck my website

OK.

But, what if I tried that?  I see you mention elsewhere on this website, that it works well to have a separate website (e.g. wordpress as an example) on the same server as iRedMail, as long as one put the files in /var/www/html

I can not do that.  The automated booktype install procedure creates /var/www/booktype. I can not change it (rename it to html) as the are a whole slew of stuff that points to this directory. So then I have a problem anyway?  Is there a forum thread/guide that show how to this? (I have not found one yet).

4

Re: IredMail wreck my website

well - but you could install iredmail AND THEN Booktype.

Also i dont think this is an Error which can not be fixed.
Its just an apache missconfig.

Its hard to help you without to know your httpd.conf and all your vhost files.
Just check them.

5 (edited by graabein 2016-04-25 01:16:23)

Re: IredMail wreck my website

OK, I have powered down my live server, temporarly replaced it with an identical droplet from DigitalOcean used for this very test.

I installed iRedMail on this fresh ubuntu 14.04 droplet, all configured as stated in your installguide.

THEN I installed Booktype using the provided automated install from http://sourcefabric.org

Here is what happens.

Acessing http://example.com gives a 500 Internal server error.  The root domain points to the virtual host file enclosed in this threads opening post.

apache2 error.log

[Sun Apr 24 12:24:22.970069 2016] [mpm_prefork:notice] [pid 1854] AH00171: Graceful restart requested, doing restart
[Sun Apr 24 12:24:28.996256 2016] [ssl:warn] [pid 1854] AH01906: RSA server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
[Sun Apr 24 12:24:28.999913 2016] [mpm_prefork:notice] [pid 1854] AH00163: Apache/2.4.7 (Ubuntu) OpenSSL/1.0.1f mod_wsgi/3.4 Python/2.7.6 configured -- resuming normal operations
[Sun Apr 24 12:24:29.000014 2016] [core:notice] [pid 1854] AH00094: Command line: '/usr/sbin/apache2'

booktype-instance1-error.log

[Sun Apr 24 18:39:24.210153 2016] [:error] [pid 13995] [remote 78.26.x.x:49633] mod_wsgi (pid=13995): Target WSGI script '/var/www/booktype/instance1/instance1_site/wsgi.py' cannot be loaded as Python module.
[Sun Apr 24 18:39:24.210252 2016] [:error] [pid 13995] [remote 78.26.x.x:49633] mod_wsgi (pid=13995): Exception occurred processing WSGI script '/var/www/booktype/instance1/instance1_site/wsgi.py'.
[Sun Apr 24 18:39:24.210300 2016] [:error] [pid 13995] [remote 78.26.x.x:49633] Traceback (most recent call last):
[Sun Apr 24 18:39:24.210336 2016] [:error] [pid 13995] [remote 78.26.x.x:49633]   File "/var/www/booktype/instance1/instance1_site/wsgi.py", line 47, in <module>
[Sun Apr 24 18:39:24.210385 2016] [:error] [pid 13995] [remote 78.26.x.x:49633]     application = get_wsgi_application()
[Sun Apr 24 18:39:24.210400 2016] [:error] [pid 13995] [remote 78.26.x.x:49633]   File "/var/lib/booktype/lib/python2.7/site-packages/django/core/wsgi.py", line 14, in get_wsgi_application
[Sun Apr 24 18:39:24.210429 2016] [:error] [pid 13995] [remote 78.26.x.x:49633]     django.setup()
[Sun Apr 24 18:39:24.210443 2016] [:error] [pid 13995] [remote 78.26.x.x:49633]   File "/var/lib/booktype/lib/python2.7/site-packages/django/__init__.py", line 20, in setup
[Sun Apr 24 18:39:24.210470 2016] [:error] [pid 13995] [remote 78.26.x.x:49633]     configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
[Sun Apr 24 18:39:24.210484 2016] [:error] [pid 13995] [remote 78.26.x.x:49633]   File "/var/lib/booktype/lib/python2.7/site-packages/django/utils/log.py", line 87, in configure_logging
[Sun Apr 24 18:39:24.210520 2016] [:error] [pid 13995] [remote 78.26.x.x:49633]     logging_config_func(logging_settings)
[Sun Apr 24 18:39:24.210532 2016] [:error] [pid 13995] [remote 78.26.x.x:49633]   File "/usr/lib/python2.7/logging/config.py", line 794, in dictConfig
[Sun Apr 24 18:39:24.210565 2016] [:error] [pid 13995] [remote 78.26.x.x:49633]     dictConfigClass(config).configure()
[Sun Apr 24 18:39:24.210579 2016] [:error] [pid 13995] [remote 78.26.x.x:49633]   File "/usr/lib/python2.7/logging/config.py", line 576, in configure
[Sun Apr 24 18:39:24.210597 2016] [:error] [pid 13995] [remote 78.26.x.x:49633]     '%r: %s' % (name, e))
[Sun Apr 24 18:39:24.210637 2016] [:error] [pid 13995] [remote 78.26.x.x:49633] ValueError: Unable to configure handler 'logfile': [Errno 13] Permission denied: '/var/www/booktype/instance1/logs/booktype.log'


Different timestamps in apache and booktype is only due to possible wrong timezone settings in booktype

Accessing httpS://example.com work as expected - redirects to httpS://example.com/mail

It looks to me that this is the same error I had when the order of installation was the opposite, booktype installed first and iRedMail installed second.
Now I have iRedMail installed first, then booktype installed second.

Same error no matter in what order I do the installations.

I have the idea, as Frankstar suggest, that it is only a matter of misconfiguration, as I don't think any of the installations overwrite any files created by the other. (I could be wrong of course)

Anyone have any idea?  Other information you want me to post?

EDIT: I can also verify that the apache webserver serve and use the booktype virtualhost file when I go to http://example.com root domain, as I can see the booktype admin email displayed in the error page.

6

Re: IredMail wreck my website

sorry, my lack of ubuntu knowlegde  refuse to help you further.
But check http.conf end all vhosts.

check all rewrite Rules

7 (edited by graabein 2016-04-25 02:55:35)

Re: IredMail wreck my website

In another attempt to use the "elimination method" to find what's the reason for this error, I have disabled default-ssl.conf (a2dissite default-ssl.conf) From the apache webserver point of view then iRedMail simply should not exist, unless url actually pointing to URL/mail (which then will trigger another error if I disable default-ssl.conf, but that is another non related issue).  My point here is that apache webserver now has only ONE virtualhost file to consider, and that is the booktype vhost file, which was put in place AFTER iRedMail, and thus the booktype vhost file is exacly the way it should be to make the booktype installation work).

So what else might iRedMail have done, particularly with the apache configuration, that may create trouble for other applications?  I think if we find this, then the problem could be solved easily?

EDIT:  It actually could be that it is Booktype that has some strange incompatible way of doing things, but how can we find out?  All I know is that there is a conflict somewhere.  And I hope developers of each application could be interested in finding out what is the reason for this conflict, and thus maybe improve their own product.  I am not blaming anyone, I just looking for a solution, and somewhere I have to go, and found it natural to go here, as Booktype was working fine until I installed iRedMail.  If we find out it is a Booktype issue, then I have no problem going there.

8

Re: IredMail wreck my website

look, its not realy a conflict between 2 products.

Both Product simply ignore the other one and push their config.
Mayb its a vhost file, mayb its a vhost in the http.conf mayb its just a rewriterule in the index.html/php

its not realy a "problem" - so either you post all your config files or noone will or can help you.
(pls use pastebin)

9

Re: IredMail wreck my website

Frankstar

Here you state you refuse to/can not help due to lack of ubuntu knowledge: http://www.iredmail.org/forum/post48237.html#p48237

And in latest comment you request me to post all my config files?  If you don't understand ubuntu, what help will you be able to give looking at ALL my config files?

I see you have only 43 posts here since the year 2010.  I have somehow a feeling you will not be able to help me.

10

Re: IredMail wreck my website

BTW, I only have two vhost files, the booktype vhost file which I have posted in the opening post, and the default-ssl.conf which ZhangHuangbin (and other support people) are very well aware the content of, so I should not have to post it.
Then there is apache.conf which is untouched by booktype, so apache.conf is the way iRedMail made it.

If someone suspect a spesific file to be the problem, then I can post that particular file if requested.  I can not just start dumping a lot of config files in here, in the hope that one of them may contain something useful for troubleshooting.

11 (edited by Frankstar 2016-04-25 04:49:14)

Re: IredMail wreck my website

graabein wrote:

Frankstar

Here you state you refuse to/can not help due to lack of ubuntu knowledge: http://www.iredmail.org/forum/post48237.html#p48237

And in latest comment you request me to post all my config files?  If you don't understand ubuntu, what help will you be able to give looking at ALL my config files?

I see you have only 43 posts here since the year 2010.  I have somehow a feeling you will not be able to help me.

lool - so help youself then smile
First thing, i use Iredmail since 2010 - you ? since half a year ?
Second, im not a support assistant or related to iredmail, im just an iredmail user and help you in my free time.

third i dont know ubuntu "commands" - but i think i understand linux 100 times better than you  - i mean you cant even fix a vhost/redirect problem an blame others who try to help you ????
And i know "ubuntu" users - if you dont post this fancy ubuntu commands - they are confused ...

mayb just look into you index.html or htaccess files .....

im out - people these days ...

12

Re: IredMail wreck my website

graabein wrote:

[Sun Apr 24 18:39:24.210637 2016] [:error] [pid 13995] [remote 78.26.x.x:49633] ValueError: Unable to configure handler 'logfile': [Errno 13] Permission denied: '/var/www/booktype/instance1/logs/booktype.log'

It's clear in the error log.

graabein wrote:

And in latest comment you request me to post all my config files?  If you don't understand ubuntu, what help will you be able to give looking at ALL my config files?

Although Ubuntu uses different binary package format (.deb), but it uses the same softwares as other Linux/BSD distributions, which means, the same configurations. It might be a good idea to stay open, be gentle.

13 (edited by graabein 2016-04-25 15:46:08)

Re: IredMail wreck my website

ZhangHuangbin wrote:
graabein wrote:

[Sun Apr 24 18:39:24.210637 2016] [:error] [pid 13995] [remote 78.26.x.x:49633] ValueError: Unable to configure handler 'logfile': [Errno 13] Permission denied: '/var/www/booktype/instance1/logs/booktype.log'

It's clear in the error log.

Well, the Booktype installation did not have this problem until IRedMail got installed. Could the "permission denied" be due to iRedMail controlling and locking some resource/functionality Booktype needs in order to - among other things - write to a log, or something.  What resource is denied when trying to "configure handler 'logfile'.  "What about WSGI?  I see both applications uses it, could there be some conflict?

Example from the above posted booktype-instance1-error.log

[Sun Apr 24 18:39:24.210153 2016] [:error] [pid 13995] [remote 78.26.x.x:49633] mod_wsgi (pid=13995): Target WSGI script '/var/www/booktype/instance1/instance1_site/wsgi.py' cannot be loaded as Python module.
[Sun Apr 24 18:39:24.210252 2016] [:error] [pid 13995] [remote 78.26.x.x:49633] mod_wsgi (pid=13995): Exception occurred processing WSGI script '/var/www/booktype/instance1/instance1_site/wsgi.py'.

Why can not target WSGI script be loaded when combined in an installation togheter with iRedMail, when it works perfectly when iRedMail is not installed?

Can it be that iRedMail configurations forces the booktype installation to use SSL even if booktype is not configured to do so?

14

Re: IredMail wreck my website

graabein wrote:

Could the "permission denied" be due to iRedMail controlling and locking some resource/functionality Booktype needs in order to - among other things - write to a log, or something.  What resource is denied when trying to "configure handler 'logfile'.

It means you don't have this file, or sub-folder, or incorrect file owner and permission.

15 (edited by graabein 2016-04-26 18:15:53)

Re: IredMail wreck my website

The main strange situation remains:

If I install iRedMail on a server that has a working/error free Booktype installation (as per install HOWTO instructions, and which initially has no other mail related applications installed), visiting the example.com/mail url works well, but visiting example.com (the booktype location) gives a 500 Internal server error.

If I install iRedMail FIRST on a fresh server(as per install HOWTO instructions), all iRedMail stuff work as expected. (of course).  If I then install Booktype SECOND and then visiting example.com/mail all works, but if I visit example.com (booktype location) I get the same 500 internal server error.

Again, if iRedMail does not get installed, then Booktype installation works without problem.

As I have followed both paths:

1. Testing iRedMail on a working server with only Booktype installed, and second, gone the extra steps of:

2. Installing iRedMail first on a fresh server (as recommended by you) and Booktype second, and still get the same errors as in path 1 above, then I had hoped you could be a bit more curious and interested in figuring out what is the problem.

I had hoped to be able to use iRedMail, but have now abandoned this idea and gone for using a Postfix send only mail server instead.

And Booktype is working....

16

Re: IredMail wreck my website

Dear graabein,

We need related error message/log, so that we can help troubleshoot.

If you get "internal server error", what's the detailed error log in log file? As mentioned in early post, booktype is a Python/uwsgi application, right? then please grab related log from uwsgi log file.

If you run Nginx as web server, iRedMail will setup uwsgi. I guess this causes the conflict. But again, we need detailed error log for troubleshooting.

17

Re: IredMail wreck my website

Hi ZhangHuangbin

I use Apache 2 webserver (mod_wsgi).  The only log I can find that outputs wsgi errors is the above pasted booktype-instance1-error.log, which you also can see here: http://pastebin.com/sYkty8Za (This from yet another attemt made today to try to find/fix solutions...but I am still stuck)

In /var/log/apache2/error.log there is nothing else than this type of warnings, which I dont think is relevant to this issue:

[Wed Apr 27 08:50:10.197187 2016] [ssl:warn] [pid 2119] AH01906: RSA server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
[Wed Apr 27 08:50:10.198360 2016] [mpm_prefork:notice] [pid 2119] AH00163: Apache/2.4.7 (Ubuntu) OpenSSL/1.0.1f mod_wsgi/3.4 Python/2.7.6 configured -- resuming normal operations
[Wed Apr 27 08:50:10.198382 2016] [core:notice] [pid 2119] AH00094: Command line: '/usr/sbin/apache2'

/etc/apache2/apache2.conf is the way iRedMail created it when installed.
/etc/apache2/sites-available/default-ssl.conf is the way iRedMail created it when installed.
/etc/apache2/sites-available/booktype-instance1.conf is as you see pasted in the opening post in this very thread. (See: http://www.iredmail.org/forum/post48222.html#p48222)

I don't know what more information I can give you.  So if you need any other spesific information/log I hope you will ask for it.

18 (edited by Frankstar 2016-04-27 17:21:02)

Re: IredMail wreck my website

show us the apache access log - i have an idea

and - did you check your index.html / php for rewrite rules ?
Did you check for htaccess files ?

19

Re: IredMail wreck my website

The error is:

[Wed Apr 27 09:30:36.836098 2016] [:error] [pid 6891] [remote 178.62.x.x:2112] ValueError: Unable to configure handler 'logfile': [Errno 13] Permission denied: '/var/www/booktype/instance1/logs/booktype.log'

So, do you have this log file? Does this file (and its parent folders) have proper file owner and permission?