1

Topic: Adding website beside iredmail

==== Required information ====
- iRedMail version (check /etc/iredmail-release):
- Linux/BSD distribution name and version: Debian Stretch
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? Yes
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

I have the same problem as described in forum here -> iRedmail/nginx adding website to home server and I followed the Steps Zhang described. But when calling the new vhost I'm always ending in SOGo instead of the new vhost.

Any hints anyone?

----

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

2

Re: Adding website beside iredmail

Could you please show us Nginx config related to this issue? And what's the expected result?

3 (edited by nuwinfo 2017-10-13 15:55:52)

Re: Adding website beside iredmail

ZhangHuangbin wrote:

Could you please show us Nginx config related to this issue? And what's the expected result?

The expected result is "Hello World" - index.php in the docroot is a simple testing one. The server delivers the wrong certificate and leads to SOGo page (ruhrmail.email) - even when I disable the listen 443 directive and port forwarding. Maybe something php-catchall.tmpl related?

This is test.conf in sites-enabled:

server {
    # Listen on ipv4
    listen 80;
    server_name test.stirnberg.net;
    root /var/www/html/test;
    index index.php index.html;

    access_log /var/log/nginx/test.log;
    error_log /var/log/nginx/testerr.log;

listen 443 ssl; # managed by Certbot
ssl_certificate /etc/ssl/certs/ssl-cert-snakeoil.pem
ssl_certificate_key /etc/ssl/private/ssl-cert-snakeoil.key
ssl_session_cache shared:le_nginx_SSL:1m; # managed by Certbot
ssl_session_timeout 1440m; # managed by Certbot
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # managed by Certbot
ssl_prefer_server_ciphers on; # managed by Certbot
ssl_ciphers "ECDHE-ECDSA-AES128-GCM-SHA256 ECDHE-ECDSA-AES256-GCM-SHA384 ECDHE-ECDSA-AES128-SHA ECDHE-ECDSA-AES256-SHA ECDHE-ECDSA-AES128-SHA256 ECDHE-ECDSA-AES256-SHA384 ECDHE-RSA-AES128-GCM-SHA2
    if ($scheme != "https") {
        return 301 https://$host$request_uri;
    } # managed by Certbot
add_header Strict-Transport-Security max-age=31536000;
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options nosniff;
add_header Referrer-Policy "no-referrer";
location / {
        try_files $uri $uri/ =404;
    }
error_page 404 /404.html;
    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
        root /usr/share/nginx/html;
    }
location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
}

4

Re: Adding website beside iredmail

nuwinfo wrote:

server {
    listen 80;
    ...
listen 443 ssl; # managed by Certbot

Why you have both 80/443 in one "server {}" block?

5

Re: Adding website beside iredmail

ZhangHuangbin wrote:
nuwinfo wrote:

server {
    listen 80;
    ...
listen 443 ssl; # managed by Certbot

Why you have both 80/443 in one "server {}" block?

Oops, overseen. Anyway - this request for support is solved because there's no need anymore to run a vhost beside iredmail. Thanks for your help.