1

Topic: Install Web apps on a subdomain on the same server.

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release):
- Deployed with iRedMail Easy or the downloadable installer? downloadable one
- Linux/BSD distribution name and version: Ubuntu 18.04 LTS
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro?
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====
Hello,
I have installed iRedMail 4/5 times in this month, it is a really good software.
My problem is that i want Roundcube and other web apps things only to be accessible on a subdomain of the server.
Something like mail.server.com. The problem is that mail.server.com and server.com are on the same IP, they are the same VPS. I think I should use Nginx's "server" blocks to redirect everything good.

Any help would be really appreciated! smile

----

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

2

Re: Install Web apps on a subdomain on the same server.

You can create a new virtual web host config file for "mail.server.com" and allow webmail access, then disable webmail access for other hosts in /etc/nginx/sites-enabled/00-default-ssl.conf (Note: http access is defined in 00-default.conf and all http traffic is redirected to https by default).

3 (edited by devedames 2021-08-25 18:21:30)

Re: Install Web apps on a subdomain on the same server.

phreq wrote:

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release):
- Deployed with iRedMail Easy or the downloadable installer? downloadable one
- Linux/BSD distribution name and version: Ubuntu 18.04 LTS
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro?
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====
Hello,
I have installed iRedMail 4/5 times in this month, it is a really good software.
My problem is that i want Roundcube and other web apps things only to be accessible on a subdomain of the server.
Something like mail.server.com. The problem is that mail.server.com and server.com are on the same IP, they are the same VPS. I think I should use Nginx's "server" blocks to redirect everything good.

Any help would be really appreciated! smile


Hi I am having this the same scenario,

REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 1.4.0
- Deployed with iRedMail Easy or the downloadable installer? downloadable one
- Linux/BSD distribution name and version: CentOS 8.2.2004 Core
- 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.
====

I am having problem to make it work.

What I have done is.
1. Under /etc/nginx/sites-available - I have copy the file "roundcube-subdomain.tmpl" from /etc/nginx/templates to mail.mydomain.com.conf
2. Edit mail.mydomain.com.conf and copy the "server {...}" from 00-default.conf
3. Link the file "mail.mydomain.com.conf" to ../sites-enabled/
4. Commented the line "include /etc/nginx/templates/roundcube.tmpl;" in the 00-default-ssl.conf file.
5. Restart nginx - failed.

I am new with nginx. Obviously I am doing this incorrectly.

Any help would be appreciated.

4

Re: Install Web apps on a subdomain on the same server.

Hi Guys,

Anyone?

Thanks in advance.

5

Re: Install Web apps on a subdomain on the same server.

Hey devedames,

here are my working config files for using webmail with a subdomain:

00-default.conf

#
# Note: This file must be loaded before other virtual host config files,
#
# HTTP
server {
    # Listen on ipv4
    listen 80;
    #listen [::]:80;

    server_name _;

    # Redirect all insecure http:// requests to https://
    return 301 https://$host$request_uri;
}

00-default-ssl.conf

#
# Note: This file must be loaded before other virtual host config files,
#
# HTTPS
server {
    listen 443 ssl;
    #listen [::]:443 ssl;
#   server_name _;
server_name domain.de www.domain.de;

    root /var/www/html;
    index index.php index.html;

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

}

#Netdata
server {
    listen 443 ssl http2;
    #listen[::]:443 ssl http2;
    server_name stats.domain.de;

    root /var/www/netdata;
    index index.php index.html;
}

#SoGo
server {
  listen 443 ssl http2;
  server_name sogo.domain.de;

  include /etc/nginx/templates/sogo-subdomain.tmpl;
}

#iRedAdmin
server {
    listen 443 ssl http2;
    #listen[::]:443 ssl http2;
    server_name ired.domain.de;

    include /etc/nginx/templates/iredadmin-subdomain.tmpl;
}

round.domain.de

server {
    listen 443 ssl http2;
    listen[::]:443 ssl http2;
    server_name round.domain.de;

    root /opt/www/roundcubemail;
    index index.php index.html index.htm;

    include /etc/nginx/templates/roundcube-subdomain.tmpl;
}

Change the domain name as needed, delete subdomains you dont and restart nginx.

Greets

6

Re: Install Web apps on a subdomain on the same server.

mike175de wrote:

Hey devedames,

here are my working config files for using webmail with a subdomain:

00-default.conf

#
# Note: This file must be loaded before other virtual host config files,
#
# HTTP
server {
    # Listen on ipv4
    listen 80;
    #listen [::]:80;

    server_name _;

    # Redirect all insecure http:// requests to https://
    return 301 https://$host$request_uri;
}

00-default-ssl.conf

#
# Note: This file must be loaded before other virtual host config files,
#
# HTTPS
server {
    listen 443 ssl;
    #listen [::]:443 ssl;
#   server_name _;
server_name domain.de www.domain.de;

    root /var/www/html;
    index index.php index.html;

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

}

#Netdata
server {
    listen 443 ssl http2;
    #listen[::]:443 ssl http2;
    server_name stats.domain.de;

    root /var/www/netdata;
    index index.php index.html;
}

#SoGo
server {
  listen 443 ssl http2;
  server_name sogo.domain.de;

  include /etc/nginx/templates/sogo-subdomain.tmpl;
}

#iRedAdmin
server {
    listen 443 ssl http2;
    #listen[::]:443 ssl http2;
    server_name ired.domain.de;

    include /etc/nginx/templates/iredadmin-subdomain.tmpl;
}

round.domain.de

server {
    listen 443 ssl http2;
    listen[::]:443 ssl http2;
    server_name round.domain.de;

    root /opt/www/roundcubemail;
    index index.php index.html index.htm;

    include /etc/nginx/templates/roundcube-subdomain.tmpl;
}

Change the domain name as needed, delete subdomains you dont and restart nginx.

Greets

Nice this works for me.

7

Re: Install Web apps on a subdomain on the same server.

mike175de wrote:

Hey devedames,

here are my working config files for using webmail with a subdomain:

00-default.conf

#
# Note: This file must be loaded before other virtual host config files,
#
# HTTP
server {
    # Listen on ipv4
    listen 80;
    #listen [::]:80;

    server_name _;

    # Redirect all insecure http:// requests to https://
    return 301 https://$host$request_uri;
}

00-default-ssl.conf

#
# Note: This file must be loaded before other virtual host config files,
#
# HTTPS
server {
    listen 443 ssl;
    #listen [::]:443 ssl;
#   server_name _;
server_name domain.de www.domain.de;

    root /var/www/html;
    index index.php index.html;

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

}

#Netdata
server {
    listen 443 ssl http2;
    #listen[::]:443 ssl http2;
    server_name stats.domain.de;

    root /var/www/netdata;
    index index.php index.html;
}

#SoGo
server {
  listen 443 ssl http2;
  server_name sogo.domain.de;

  include /etc/nginx/templates/sogo-subdomain.tmpl;
}

#iRedAdmin
server {
    listen 443 ssl http2;
    #listen[::]:443 ssl http2;
    server_name ired.domain.de;

    include /etc/nginx/templates/iredadmin-subdomain.tmpl;
}

round.domain.de

server {
    listen 443 ssl http2;
    listen[::]:443 ssl http2;
    server_name round.domain.de;

    root /opt/www/roundcubemail;
    index index.php index.html index.htm;

    include /etc/nginx/templates/roundcube-subdomain.tmpl;
}

Change the domain name as needed, delete subdomains you dont and restart nginx.

Greets

Wow! Thank you so much! You cannot imagine how much time I have wasted searching for a working solution for this.