1

Topic: How to enable my site near iRedMail

I installed one forum but it doesn't work. I checked nginx, put there the lines that forum needs to be enabled but there's nothing. What else should I do?
/etc/nginx/sites-available/00-default.conf this is what I edited. Restarted. But there's nothing.

----

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

2

Re: How to enable my site near iRedMail

post the entry that you added to your 00-default.conf file and an example of what happens when you try go to the forum site (does it give error, does it go to iredadmin or roundcube, etc)

I assume you also restarted nginx after updating your conf file?

3 (edited by danonanon 2020-05-10 13:40:13)

Re: How to enable my site near iRedMail

MuPp3t33r wrote:

post the entry that you added to your 00-default.conf file and an example of what happens when you try go to the forum site (does it give error, does it go to iredadmin or roundcube, etc)

I assume you also restarted nginx after updating your conf file?

#
# 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;
}

server {

  listen 80;
  server_name mysite.tk;
  root /var/www/vanilla;
  index index.php;

  location ~* /\.git { deny all; return 403; }
  location /build/ { deny all; return 403; }
  location /cache/ { deny all; return 403; }
  location /cgi-bin/ { deny all; return 403; }
  location /uploads/import/ { deny all; return 403; }
  location /conf/ { deny all; return 403; }
  location /tests/ { deny all; return 403; }
  location /vendor/ { deny all; return 403; }

  location ~* ^/index\.php(/|$) {
    include snippets/fastcgi-php.conf;
    fastcgi_param SCRIPT_NAME /index.php;
    fastcgi_param SCRIPT_FILENAME $realpath_root/index.php;
    fastcgi_param X_REWRITE 1;
    fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
  }

  location ~* \.php(/|$) {
    rewrite ^ /index.php$uri last;
  }

  location / {
    try_files $uri $uri/ @vanilla;
  }

  location @vanilla {
    rewrite ^ /index.php$uri last;
  }

}

I just add second server listen on 80 port. Restarted nginx but there's nothing.
When I go on my site I'm just being redirected to https://mysite.tk/mail/

How to fix it please?

Does iredmail able to work alongside hosted sites?

4

Re: How to enable my site near iRedMail

I have same problem. Despite I configured 00-deafult.conf with miysite.com; domain name it still goes to mysite.com/mail

I'm using debian10 and nginx.

Iredmail added its own templates to my 00-default-ssl.conf , so I changed the include parameter from /etc/nginx/templates/roundcube.tmpl to roundcube-subdomain.tmpl file

That made possible to access to my desired mymail.mysite.com subdomain name to access roundcube, but still my main server virtualhost points mysite.com directly to mysite.com/mail

So, I modified roundcube-subdomain.tmpl file changing the location / parameter to another like /mymail . That made this:

- Point mysite.com to /mail but this time a 404 not found error
- point mysite.com/mail to my /var/www/html principal site.

Thanks in advance for your help

5

Re: How to enable my site near iRedMail

danonanon wrote:

I just add second server listen on 80 port. Restarted nginx but there's nothing.
When I go on my site I'm just being redirected to https://mysite.tk/mail/

How to fix it please?

Does iredmail able to work alongside hosted sites?

In the beginning of your conf file you have a 80 to 443 redirect making it impossible to access your site on 80.
You could try change the order in the conf file, or for the sake of making management easier, it's typically done by putting your sites in their own dedicated conf file, makes it easier to see whats where...

6 (edited by danonanon 2020-05-11 02:23:25)

Re: How to enable my site near iRedMail

luismsanchez wrote:

I have same problem. Despite I configured 00-deafult.conf with miysite.com; domain name it still goes to mysite.com/mail

I'm using debian10 and nginx.

Iredmail added its own templates to my 00-default-ssl.conf , so I changed the include parameter from /etc/nginx/templates/roundcube.tmpl to roundcube-subdomain.tmpl file

That made possible to access to my desired mymail.mysite.com subdomain name to access roundcube, but still my main server virtualhost points mysite.com directly to mysite.com/mail

So, I modified roundcube-subdomain.tmpl file changing the location / parameter to another like /mymail . That made this:

- Point mysite.com to /mail but this time a 404 not found error
- point mysite.com/mail to my /var/www/html principal site.

Thanks in advance for your help

I hope I can help you.
If you set SSL serttificate, then change 00-default-ssl.conf, if you didn't set SSL sert, then change 00-default.conf
For example. I have iRedmail and vanilla forum. I maybe have iRedMail and your wordpress site

THIS IS FOR 00-defaul.conf, you if installed SSL, then change 00-default-ssl.conf and instead of 80 port it should be 443!
#
# Note: This file must be loaded before other virtual host config files,
#
# HTTP
server {
    # Listen on ipv4
    listen 80;
    listen [::]:80;

    server_name mymail.yoursite.ru;

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

server {

  listen 80;
  server_name yoursite.ru www.yoursite.ru;
  root /var/www/;
  index index.php;

}

server {
server_name www.yoursite.ru;
return 301 $scheme://yoursite.ru$request_uri;
}

So you see, the first server { is for your iRedmail. The second server { is for your website (wordpress), just don't forget ot change the path if it's not defaul (root /var/www/ maybe it's root /var/www/html/ on your side). The third server { is for make work www.yourdomain.ru and to redirect to yourdomain.ru

Also don't forget to change /etc/hosts
It should be something like that
127.0.0.1 mymail.yoursite.ru localhost

Make a reboot

7 (edited by danonanon 2020-05-11 02:27:20)

Re: How to enable my site near iRedMail

MuPp3t33r wrote:
danonanon wrote:

I just add second server listen on 80 port. Restarted nginx but there's nothing.
When I go on my site I'm just being redirected to https://mysite.tk/mail/

How to fix it please?

Does iredmail able to work alongside hosted sites?

In the beginning of your conf file you have a 80 to 443 redirect making it impossible to access your site on 80.
You could try change the order in the conf file, or for the sake of making management easier, it's typically done by putting your sites in their own dedicated conf file, makes it easier to see whats where...

Thank you. Could you please help me in stopping antivirus and spam things? I used this guide
https://docs.iredmail.org/completely.di … assin.html
but after Disable network services: Amavisd, ClamAV iRedMail sends messages that don't reach the recipient. Thank you.

8

Re: How to enable my site near iRedMail

Thanks for your help, but I couldn´t managed to work.

First, I checked my /etc/hosts file. It works fine with apache. (Why I don´t use apache instead of ngins if it works? Because Iredmail has installed by default nginx and I couldn´t reproduce it in apache to work as fine as it does in nginx. So I had to change and start learning Nginx, that is good for me, despite this problem)

Then, I removed all my /sites-enabled .conf files.

After I used this default.conf file you gave me.

It still goes to mysite.com/mail.

So, I modified the independent .conf files for each virtualhost to match your advice. Nothing, again, not only redirecting to /mail folder.

So, I have:

mysite.com -> redirecting to mysite.com/mail  // I don´t have a mail folder, then I thought "I´ll have to make a /mail dir and put my main site there. I did and it redirects and redirects and never stops to show my demo files on there.

Now, like in the begining:
I have:

mysite.com -> redirecting again to mysite.com/mail and 404 not found error.
mail.mysite.com -> ok going to its subdomain name
wordpress.mysite.com --> ok going to its subdomain name

I guess, only guess:

There´s some kind of pre-config that iredmail do with nginx to make this happen and this hasn´t to do with templates or .conf files.

Thanls again in advance

danonanon wrote:
luismsanchez wrote:

I have same problem. Despite I configured 00-deafult.conf with miysite.com; domain name it still goes to mysite.com/mail

I'm using debian10 and nginx.

Iredmail added its own templates to my 00-default-ssl.conf , so I changed the include parameter from /etc/nginx/templates/roundcube.tmpl to roundcube-subdomain.tmpl file

That made possible to access to my desired mymail.mysite.com subdomain name to access roundcube, but still my main server virtualhost points mysite.com directly to mysite.com/mail

So, I modified roundcube-subdomain.tmpl file changing the location / parameter to another like /mymail . That made this:

- Point mysite.com to /mail but this time a 404 not found error
- point mysite.com/mail to my /var/www/html principal site.

Thanks in advance for your help

I hope I can help you.
If you set SSL serttificate, then change 00-default-ssl.conf, if you didn't set SSL sert, then change 00-default.conf
For example. I have iRedmail and vanilla forum. I maybe have iRedMail and your wordpress site

THIS IS FOR 00-defaul.conf, you if installed SSL, then change 00-default-ssl.conf and instead of 80 port it should be 443!
#
# Note: This file must be loaded before other virtual host config files,
#
# HTTP
server {
    # Listen on ipv4
    listen 80;
    listen [::]:80;

    server_name mymail.yoursite.ru;

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

server {

  listen 80;
  server_name yoursite.ru www.yoursite.ru;
  root /var/www/;
  index index.php;

}

server {
server_name www.yoursite.ru;
return 301 $scheme://yoursite.ru$request_uri;
}

So you see, the first server { is for your iRedmail. The second server { is for your website (wordpress), just don't forget ot change the path if it's not defaul (root /var/www/ maybe it's root /var/www/html/ on your side). The third server { is for make work www.yourdomain.ru and to redirect to yourdomain.ru

Also don't forget to change /etc/hosts
It should be something like that
127.0.0.1 mymail.yoursite.ru localhost

Make a reboot

9

Re: How to enable my site near iRedMail

What's the content of your /var/www/index.html file?

10

Re: How to enable my site near iRedMail

For now I have the default apache index.html and the default nginx iredmail.index

I have thus update. I tried to use apache again, erased cache, checked and even in apache mysite.com redirects to mysite.com/mail
Browser alert that mysite is trien to redirdct and asked for my authorization.

Also I have a test info.php in that html folder: with apache it shows phph info. With nginx a blank page.



ZhangHuangbin wrote:

What's the content of your /var/www/index.html file?