1

Topic: Nginx 1.8 and broke http to https redirect

==== Required information ====
- iRedMail version (check /etc/iredmail-release): lastest
- Linux/BSD distribution name and version: U 14.04
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): LDAP
- Web server (Apache or Nginx): Nginx 1.8
- Manage mail accounts with iRedAdmin-Pro? No
- Related log if you're reporting an issue:
====

When I update Nginx to 1.8, it asked to replace the iRedMail-modified nginx.conf with the latest nginx.conf, I accepted that, and my site had broke http to https redirect

I run sudo nginx -t and face below warnings:

nginx: [warn] conflicting server name "_" on 0.0.0.0:80, ignored
nginx: [warn] conflicting server name "_" on [::]:80, ignored

After checking, I replace the server_name in both http and https as follows:

Old:

server_name _;

New:

sever_name mail.example.com;

and it works!

Do I have to modify anything to make sure that iRedMail is in good configuration?

Thank you and best regards,

Quy

----

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

2

Re: Nginx 1.8 and broke http to https redirect

Does it backup original iRedMail configured Nginx config file? if yes, please restore it. If not, please get a sample nginx.conf below and replace all placeholders (PH_*) by the real value:
https://bitbucket.org/zhb/iredmail/src/ … les/nginx/

3

Re: Nginx 1.8 and broke http to https redirect

ZhangHuangbin wrote:

Does it backup original iRedMail configured Nginx config file? if yes, please restore it. If not, please get a sample nginx.conf below and replace all placeholders (PH_*) by the real value:
https://bitbucket.org/zhb/iredmail/src/ … les/nginx/

The only missing part of the new nginx.conf comparing to the iRedMail's one is:

upstream php_workers {
    server unix:/var/run/php-fpm.socket;

but this line is included in /etc/nginx/conf.d/default.conf, so I think that it doesn't need to be added again in the nginx.conf

Am I correct?

4

Re: Nginx 1.8 and broke http to https redirect

I checked the logwatch email and noticed the below:

403 Forbidden
       /SOGo/connect: 4 Time(s)
    404 Not Found
       /favicon.ico: 17 Time(s)
       /cgi-bin/test.sh: 8 Time(s)
       /admin.cgi: 5 Time(s)
       /cgi-bin-sdb/printenv: 5 Time(s)
       /cgi-bin/bash: 5 Time(s)
       /cgi-bin/hello: 5 Time(s)
       /cgi-bin/helpme: 5 Time(s)
       /cgi-bin/info.sh: 5 Time(s)
       /cgi-bin/php5-cli?: 5 Time(s)
       /cgi-bin/php5?: 5 Time(s)
       /cgi-bin/test-cgi: 5 Time(s)
       /cgi-bin/test.cgi: 5 Time(s)
       /cgi-mod/index.cgi: 5 Time(s)
       /cgi-sys/defaultwebpage.cgi: 5 Time(s)
       /cgi-sys/entropysearch.cgi: 5 Time(s)
       /cgi-sys/guestbook.cgi: 5 Time(s)
       /cgi-sys/php5?: 5 Time(s)
       /phppath/cgi_wrapper?: 5 Time(s)
       /cgi-bin/: 3 Time(s)
       /cgi-bin/%2f/admin.html: 3 Time(s)
       /cgi-bin/ICuGI/EST/blast_detail.cgi: 3 Time(s)
       /cgi-bin/admin.html: 3 Time(s)
       /cgi-bin/contact.cgi: 3 Time(s)
       /cgi-bin/defaultwebpage.cgi: 3 Time(s)
       /cgi-bin/env.cgi: 3 Time(s)
       /cgi-bin/firmwarecfg: 3 Time(s)
       /cgi-bin/forum.cgi: 3 Time(s)
       /cgi-bin/hello.cgi: 3 Time(s)
       /cgi-bin/index.cgi: 3 Time(s)
       /cgi-bin/login.cgi: 3 Time(s)
       /cgi-bin/main.cgi: 3 Time(s)
       /cgi-bin/meme.cgi: 3 Time(s)
       /cgi-bin/php: 3 Time(s)
       /cgi-bin/php-cgi: 3 Time(s)
       /cgi-bin/php.cgi: 3 Time(s)
       /cgi-bin/php4: 3 Time(s)
       /cgi-bin/php5: 3 Time(s)
       /cgi-bin/recent.cgi: 3 Time(s)
       /cgi-bin/sat-ir-web.pl: 3 Time(s)
       /cgi-bin/signon.cgi: 3 Time(s)
       /cgi-bin/status/status.cgi: 3 Time(s)
       /cgi-bin/test-cgi.pl: 3 Time(s)
       /cgi-bin/tools/tools.pl: 3 Time(s)
       /cgi-bin/tree.php: 3 Time(s)
       /cgi-bin/w3mman2html.cgi: 3 Time(s)
       /cgi-sys/FormMail-clone.cgi: 3 Time(s)
       /dana-na/auth/url_default/welcome.cgi: 3 Time(s)
       /gitweb.cgi: 3 Time(s)
       /gitweb/: 3 Time(s)
       /phppath/cgi_wrapper: 3 Time(s)
       /phppath/php: 3 Time(s)
       /phppath/php?: 3 Time(s)
       /sys-cgi: 3 Time(s)
       /tmUnblock.cgi: 3 Time(s)
       /xul/: 3 Time(s)
       /pma/scripts/setup.php: 2 Time(s)
       /cgi-bin/php-cgi.bin?%2D%64+%61%6C%6C%6F%7 ... 70%75%74+%2D%6E: 1 Time(s)
       /cgi-bin/php-cgi?%2D%64+%61%6C%6C%6F%77%5F ... 70%75%74+%2D%6E: 1 Time(s)
       /cgi-bin/php5-cgi?%2D%64+%61%6C%6C%6F%77%5 ... 70%75%74+%2D%6E: 1 Time(s)
       /cgi-bin/php5?%2D%64+%61%6C%6C%6F%77%5F%75 ... 70%75%74+%2D%6E: 1 Time(s)
       /cgi-bin/php?%2D%64+%61%6C%6C%6F%77%5F%75% ... 70%75%74+%2D%6E: 1 Time(s)
       /myadmin/scripts/setup.php: 1 Time(s)
       /phpMyAdmin/scripts/setup.php: 1 Time(s)
       /sitemap.xml: 1 Time(s)
       /themes/elastixneo/ie.css: 1 Time(s)

Is there anything wrong?

5

Re: Nginx 1.8 and broke http to https redirect

Does your /etc/nginx/nginx.conf has line below inside `http {}` block?

include /etc/nginx/conf.d/*.conf;

6

Re: Nginx 1.8 and broke http to https redirect

ZhangHuangbin wrote:

Does your /etc/nginx/nginx.conf has line below inside `http {}` block?

include /etc/nginx/conf.d/*.conf;

both:

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;

are in the nginx.conf

7

Re: Nginx 1.8 and broke http to https redirect

Comment out "include /etc/nginx/sites-enabled/*;" line, restart Nginx and try again.

8

Re: Nginx 1.8 and broke http to https redirect

ZhangHuangbin wrote:

Comment out "include /etc/nginx/sites-enabled/*;" line, restart Nginx and try again.


Today I received the below from email:

/etc/cron.daily/logrotate:
Stopping iredapd ...
Starting iredapd ...
error: error running shared postrotate script for '/var/log/nginx/*.log '
run-parts: /etc/cron.daily/logrotate exited with return code 1
/etc/cron.daily/tmpreaper:
Please read /usr/share/doc/tmpreaper/README.security.gz first;
edit /etc/tmpreaper.conf to remove this message (look for SHOWWARNING).


Could you please straighten the problem for me with thanks

9

Re: Nginx 1.8 and broke http to https redirect

Does it happen everyday or just this time?

10

Re: Nginx 1.8 and broke http to https redirect

I had fixed the issue with the rotation of nginx log file.

11

Re: Nginx 1.8 and broke http to https redirect

Could you please show us what you changed? It may help others who have the same issue.

12

Re: Nginx 1.8 and broke http to https redirect

You receive these emails about a failed cron job:

Subject

Cron test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )

The body of the email is:

/etc/cron.daily/logrotate: error: error running shared postrotate script for '/var/log/nginx/*.log ' run-parts: /etc/cron.daily/logrotate exited with return code 1



This is how I fixed it:

sudo service nginx rotate

Then the problem disappears smile