0
저는 이미 디지털 바다에서 2 대의 서버를 운영하고 있으며 웹 서버용 nginx와 응용 프로그램 서버용 nodejs를 설치했습니다.Nodejs 리버스 프록시 서버 (nginx)
응용 프로그램 서버의 경우 : Nodeapp 디렉토리 :/var/appdata/myapp/ 4680 포트에서 실행중인 Nodej 앱. 그러나 응용 프로그램 서버에 내가 가진 부부의 iptables 옵션 (방화벽)
IPTABLES 옵션 I는 애플리케이션 서버를 위해 한 :
*filter
# Default policy is to drop all traffic
-P INPUT DROP
-P FORWARD DROP
-P OUTPUT DROP
# Allow all loopback traffic
-A INPUT -i lo -j ACCEPT
-A OUTPUT -o lo -j ACCEPT
# Allow ping.
-A INPUT -p icmp -m state --state NEW --icmp-type 8 -j ACCEPT
# Allow incoming SSH, HTTP and HTTPS traffic
-A INPUT -i eth0 -p tcp -m multiport --dports 22,80,443 -m state --state NEW,ESTABLISHED -j ACCEPT
-A OUTPUT -o eth0 -p tcp -m multiport --sports 22,80,443 -m state --state ESTABLISHED -j ACCEPT
# Allow inbound traffic from established connections.
# This includes ICMP error returns.
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# Log what was incoming but denied (optional but useful).
-A INPUT -m limit --limit 5/min -j LOG --log-prefix "iptables_INPUT_denied: " --log-level 7
# Allow outgoing SSH, HTTP and HTTPS traffic
# This is useful because we won't be able to download and install
# NPM packages otherwise and use git over SSH
-A OUTPUT -o eth0 -p tcp -m multiport --dports 22,80,443 -m state --state NEW,ESTABLISHED -j ACCEPT
-A INPUT -i eth0 -p tcp -m multiport --sports 22,80,443 -m state --state ESTABLISHED -j ACCEPT
# Allow dns lookup
-A OUTPUT -p udp -o eth0 --dport 53 -j ACCEPT
-A INPUT -p udp -i eth0 --sport 53 -j ACCEPT
# Set rate limits for DOS attack prevention (optional)
# The rates here greatly depend on your application
-A INPUT -p tcp -m multiport --dports 80,443 -m limit --limit 250/minute --limit-burst 1000 -j ACCEPT
# Log any traffic which was sent to you
# for forwarding (optional but useful).
-A FORWARD -m limit --limit 5/min -j LOG --log-prefix "iptables_FORWARD_denied: " --log-level 7
COMMIT
웹 서버의 기본 설정은 모든 이들과 함께 this-
listen 80 default_server;
listen [::]:80 default_server;
# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
server_name _;
location/{
proxy_pass http://10.135.9.223:4680 ;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
같다 옵션 나는 추측하는 모든 것을 거의 적어 둡니다. 그러나 무엇이라도 놓친다면 pls에게 알려주겠습니다. 내가 방화벽 문제가없는 사용하지 않으면 : 나는 http://web-server-ip-address에 대한 URL을 입력 할 때 그래서 여기에 주요 문제는 504 게이트웨이가
편집
시간 초과 응답 입니다.
방화벽이'10.135.47.36'을 말한다 오류가 이러한 유형에 익숙하지 않은 경우 cloudflare에 이점을,의 nginx의 설정은'10.135.9.223' 말한다? Node.js 서버가 로컬에서 (nginx로) 실행중인 경우,'127.0.0.1'을 사용하십시오. – robertklep
이것은 내가 웹 서버 local-ip에 대해 1223 포트를 허용했기 때문입니다. –
오하이오. 두 개의 별도 (가상) 서버에서 실행 중입니다. 웹 서버에서 10.135.9.223:4680에 도달 할 수 있습니까? 또한 포트 1223은 어디서 오는가? 무엇을 듣고 있습니까? – robertklep