Eu quero fazer um servidor de email. Mas eu quero que meu servidor de e-mail não se conecte diretamente à internet. Então eu faço outro servidor que seja acessível via internet e usando proxy reverso com nginx. Mas, por algum motivo, o proxy reverso não pode se conectar ao servidor de email.
Aqui está o meu conf nginx:
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
stream {
log_format proxy '$remote_addr [$time_local] '
'$protocol $status $bytes_sent $bytes_received '
'$session_time "$upstream_addr" '
'"$upstream_bytes_sent" "$upstream_bytes_received" "$upstream_connect_time"';
access_log /var/log/nginx/access.stream.log proxy;
server {
listen 25;
#protocol smtp;
proxy_pass 10.0.1.15:25;
}
server {
listen 110;
#protocol pop3;
proxy_pass 10.0.1.15:110;
}
server {
listen 143;
#protocol imap;
proxy_pass 10.0.1.15:143;
}
}
Aqui está o meu log de erros
2017/09/08 09:02:56 [error] 1444#1444: *5 connect() failed (111: Connection refused) while connecting to upstream, client: 54.240.25.13, server: 0.0.0.0:25, upstream: "10.0.1.15:25", bytes from/to client:0/0, bytes from/to upstream:0/0
2017/09/08 09:06:38 [error] 1444#1444: *7 connect() failed (111: Connection refused) while connecting to upstream, client: 209.85.128.182, server: 0.0.0.0:25, upstream: "10.0.1.15:25", bytes from/to client:0/0, bytes from/to upstream:0/0
2017/09/08 09:07:57 [error] 1444#1444: *9 connect() failed (111: Connection refused) while connecting to upstream, client: 54.240.25.4, server: 0.0.0.0:25, upstream: "10.0.1.15:25", bytes from/to client:0/0, bytes from/to upstream:0/0
2017/09/08 09:16:10 [notice] 1951#1951: signal process started
2017/09/08 09:16:42 [error] 1952#1952: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 74.125.82.46, server: 0.0.0.0:25, upstream: "10.0.1.15:25", bytes from/to client:0/0, bytes from/to upstream:0/0
2017/09/08 09:19:39 [error] 1952#1952: *3 connect() failed (111: Connection refused) while connecting to upstream, client: 54.240.25.8, server: 0.0.0.0:25, upstream: "10.0.1.15:25", bytes from/to client:0/0, bytes from/to upstream:0/0
2017/09/08 09:22:51 [error] 1952#1952: *5 connect() failed (111: Connection refused) while connecting to upstream, client: 74.125.82.50, server: 0.0.0.0:25, upstream: "10.0.1.15:25", bytes from/to client:0/0, bytes from/to upstream:0/0
2017/09/08 09:26:10 [emerg] 9086#9086: unknown log format "main" in /etc/nginx/nginx.conf:19
2017/09/08 09:27:09 [notice] 9090#9090: signal process started
2017/09/08 09:27:53 [error] 9091#9091: *7 connect() failed (111: Connection refused) while connecting to upstream, client: 209.85.128.176, server: 0.0.0.0:25, upstream: "10.0.1.15:25", bytes from/to client:0/0, bytes from/to upstream:0/0
2017/09/08 09:28:37 [error] 9091#9091: *9 connect() failed (111: Connection refused) while connecting to upstream, client: 209.85.128.170, server: 0.0.0.0:25, upstream: "10.0.1.15:25", bytes from/to client:0/0, bytes from/to upstream:0/0
Eu já verifiquei o link . Mas eu quero redirecionar e-mails enviados para o meu servidor de e-mail
atualizar
[ec2-user@ip-10-0-1-15 ~]$ sudo netstat -nlp | grep :25
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1032/master
tcp6 0 0 ::1:25 :::* LISTEN 1032/master
já comentando o inet_interface e ainda o mesmo
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1032/master
tcp6 0 0 ::1:25 :::* LISTEN 1032/master