I recently uninstalled apache2 for Nginx I'm trying to listen on 88, 808 and 888 for my sites and redirect different subdomains for each (and another domain to another server). the problem is that Nginx is giving bad gateway for all proxied requests and timeout for the direct ip access.
proxy conf : --> otherdomain.fr = eror 502 bad gateway
# HTTP
server {
# Listen on ipv4
listen 80;
#listen [::]:80;
server_name ~.*.otherdomain.fr;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass "http://192.168.1.17";
}
}
server{
listen 80;
server_name nextcloud.domain.me;
location / {
proxy_set_header Host $host;
proxy_pass "http://127.0.0.1:888";
proxy_redirect off;
}
}
server{
listen 80;
server_name domain.me;
location / {
proxy_set_header Host $host;
proxy_pass "http://127.0.0.1:808";
proxy_redirect off;
}
}
ex for port 88: --> ip:88 = timeout
(obviously, it is enabled and the nginx user have access to the files)
server {
# Listen on ipv4
listen 88;
location / {
root /var/www/html/tests;
}
}
I'm obviously doing something wrong but I cant find out what, if you could give me a hand it would be incredible. Thank you in advance!
EDIT :
netstat -tulpen | grep -E '8.?8'
tcp 0 0 127.0.0.1:10028 0.0.0.0:*
LISTEN 0 28186 1929/master tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 0 91603 8801/nginx: master tcp 0 0 127.0.0.1:12340
0.0.0.0:* LISTEN 0 25868 734/dovecot tcp 0 0 127.0.0.1:631 0.0.0.0:*
LISTEN 0 19881 497/cupsd tcp 0 0 0.0.0.0:88 0.0.0.0:* LISTEN 0 75033 8801/nginx: master tcp 0 0 0.0.0.0:888
0.0.0.0:* LISTEN 0 75032 8801/nginx: master tcp 0 0 0.0.0.0:443 0.0.0.0:*
LISTEN 0 75030 8801/nginx: master tcp 0
0 127.0.0.1:10025 0.0.0.0:* LISTEN 0
28182 1929/master udp6 0 0 :::32885
:::* 113 21172
482/avahi-daemon: r"""
netstat -tulpen | grep -E '8.?8?'`` ? Do you have
listen` directives for all of these ports?~.*.
in servername?error.log
?