1

Topic: roundcube mail subdomain error

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 1.5.2
- Deployed with iRedMail Easy or the downloadable installer? yes
- Linux/BSD distribution name and version:  centos 8
- Store mail accounts in which backend (LDAP/MySQL/PGSQL):  mysql
- Web server (Apache or Nginx): nginx
- Manage mail accounts with iRedAdmin-Pro? no
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====
When I enable roundcube-subdomain.tmpl
I get this error and can not start nginx
2022/05/03 12:51:25 [emerg] 95040#0: duplicate location "/" in /etc/nginx/templates/roundcube-subdomain.tmpl:16
here is roundcube-subdomain.tmpl

#
# Run Roundcube as a sub-domain virtual host.
#
# Block access to default directories and files under these directories
location ~ ^/(bin|config|installer|logs|SQL|temp|vendor)/.* { deny all; }

# Block access to default files under top-directory and files start with same name.
location ~ ^/(CHANGELOG|composer.json|INSTALL|jsdeps.json|LICENSE|README|UPGRADING)$ { deny all; }

# Block plugin config files and sample config files.
location ~ ^/plugins/.*/config.inc.php.* { deny all; }

# Block access to plugin data
location ~ ^/plugins/enigma/home($|/.*) { deny all; }

location / {
    root    /opt/www/roundcubemail;
    index   index.php index.html;
    include /etc/nginx/templates/hsts.tmpl;
}

location ~ \.php$ {
    root /opt/www/roundcubemail;
    include /etc/nginx/templates/fastcgi_php.tmpl;
    fastcgi_param SCRIPT_FILENAME /opt/www/roundcubemail$fastcgi_script_name;
}

----

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

2

Re: roundcube mail subdomain error

Please check other Nginx config files, it says you have duplicate "location / {}" blocks.

3 (edited by Blisk 2022-05-09 04:38:41)

Re: roundcube mail subdomain error

I have this for phpmyadmin is this what is wrong? I am new to nginx.
    location / {
        index  index.php;
  allow   XX.XX.167.111;
      deny    all;
    }

4

Re: roundcube mail subdomain error

If you have duplicate "location / {}" for same host, please change the URI to avoid duplicate.

5 (edited by Blisk 2022-05-15 17:54:35)

Re: roundcube mail subdomain error

Today I have installed new server and new Iredmail, I didn't change anything.
Just add this into
00-default-ssl.conf

    include /etc/nginx/templates/misc.tmpl;
    include /etc/nginx/templates/ssl.tmpl;
    include /etc/nginx/templates/iredadmin.tmpl;
    include /etc/nginx/templates/iredadmin-subdomain.tmpl;
    include /etc/nginx/templates/roundcube.tmpl;
    include /etc/nginx/templates/roundcube-subdomain.tmpl;
    include /etc/nginx/templates/sogo.tmpl;
    include /etc/nginx/templates/netdata.tmpl;
    include /etc/nginx/templates/netdata-subdomain.tmpl;
    include /etc/nginx/templates/php-catchall.tmpl;
    include /etc/nginx/templates/stub_status.tmpl;


And I have the same error. You have a bug in your installation.
2022/05/15 05:46:02 [emerg] 3402#0: duplicate location "/" in /etc/nginx/templates/roundcube-subdomain.tmpl:16
2022/05/15 05:46:14 [emerg] 3421#0: duplicate location "/" in /etc/nginx/templates/roundcube-subdomain.tmpl:16
2022/05/15 05:53:25 [emerg] 4724#0: duplicate location "/" in /etc/nginx/templates/netdata-subdomain.tmpl:6

6

Re: roundcube mail subdomain error

Blisk wrote:

    include /etc/nginx/templates/iredadmin-subdomain.tmpl;
    include /etc/nginx/templates/roundcube-subdomain.tmpl;
    include /etc/nginx/templates/netdata-subdomain.tmpl;

These 3 files add 3 "location / {}" blocks. Why do you add them together? You cannot run 3 different web applications under same URL.

7 (edited by Blisk 2022-05-20 17:45:33)

Re: roundcube mail subdomain error

ZhangHuangbin wrote:
Blisk wrote:

    include /etc/nginx/templates/iredadmin-subdomain.tmpl;
    include /etc/nginx/templates/roundcube-subdomain.tmpl;
    include /etc/nginx/templates/netdata-subdomain.tmpl;

These 3 files add 3 "location / {}" blocks. Why do you add them together? You cannot run 3 different web applications under same URL.

Don't understand what you mean?
subdomain roundcube-subdomain.tmpl means it wil work on roundcube.mydomain.com
and subdomain netdata-subdomain.tmpl will work on netdata.mydomain.com

or I am wrong?? and this is not created that way in iRedMail?