1

Topic: Issue configuring Nginx Reverse proxy

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release):
- Deployed with iRedMail Easy or the downloadable installer?
- Linux/BSD distribution name and version:
- Store mail accounts in which backend (LDAP/MySQL/PGSQL):
- Web server (Apache or Nginx):
- Manage mail accounts with iRedAdmin-Pro?
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

Hi All,

I'm wondering if this is possible.  I have just installed Iredmail and it's working fine however I am trying to get it to work alongside apache2 what I would like is for all requests that come in from mail.mydomainname.com to be handled by nginx
and for all other requests to be handled by apache2 so www.mydomainname.com or mydomainname.com would be handled by apache2.

I've configured a server block as shown below:

server {
    listen 80;
    server_name mydomainname www.mydomainname.com;

    location / {
        proxy_pass http://127.0.0.1:8080;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

and apache2 config is listen on port 8080 and vhost is as shown below:

<VirtualHost *:*>
    ServerName mydomainname.com
    ServerAlias www.mydomainname.com
    DocumentRoot /var/www/mydomainname.com
    <Directory /var/www/mydomainname.com>
        AllowOverride All
    </Directory>
</VirtualHost>

however when navigating to mydomainname.com I am getting connection refused

root@dbjoe1:/etc/nginx/sites-enabled# curl -v databasejoe.com:8080
* Rebuilt URL to: databasejoe.com:8080/
*   Trying 5.77.36.131...
* TCP_NODELAY set
* Connected to databasejoe.com (5.77.36.131) port 8080 (#0)
> GET / HTTP/1.1
> Host: databasejoe.com:8080
> User-Agent: curl/7.58.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Sat, 18 Jan 2020 12:43:25 GMT
< Server: Apache/2.4.29 (Ubuntu)
< Last-Modified: Sat, 18 Jan 2020 12:00:15 GMT
< ETag: "0-59c68cd2722fe"
< Accept-Ranges: bytes
< Content-Length: 0
< Content-Type: text/html
<
* Connection #0 to host databasejoe.com left intact
root@dbjoe1:/etc/nginx/sites-enabled# curl -v databasejoe.com:80
* Rebuilt URL to: databasejoe.com:80/
*   Trying 5.77.36.131...
* TCP_NODELAY set
* connect to 5.77.36.131 port 80 failed: Connection refused
* Failed to connect to databasejoe.com port 80: Connection refused
* Closing connection 0
curl: (7) Failed to connect to databasejoe.com port 80: Connection refused

----

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

2

Re: Issue configuring Nginx Reverse proxy

Why not use only Nginx? What's the concern or issue with running Nginx?

3 (edited by MillisJonny 2021-04-27 21:20:40)

Re: Issue configuring Nginx Reverse proxy

What proxy do you use? Try using other proxies, where it is much easier to configure them. I've always used free proxy servers. Sometimes they didn't function properly, which made me very angry, because I use them for my privacy. And one day, I decided to try paid proxy servers. I decided to Google and came across one site proxies.com. And then I realized that paid proxy servers are a completely different level. I went to any sites, and my proxies were not even detected. So maybe try other programs, my friend.

4

Re: Issue configuring Nginx Reverse proxy

Got the same issue as yours. Your solving method is not working for me.

5

Re: Issue configuring Nginx Reverse proxy

It is not working for me. Also, I copypasted your code and double-checked, but it seems not working because of the app update.