Nginx lauscht auf port 80 oder 443, aber nicht antwortet
Meinem server funktionierte sehr gut, bis paar Stunden, wenn es irgendwie aufgehört Beantwortung Anrufe,
Ich dachte mir, dass das Einhorn ist in Ordnung (curl localhost:3000 arbeitet - wo 3000 ist der Hafen von unicorn)
Ich ran:
sudo netstat -anltp
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 5664/mysqld
tcp 0 0 my.public.ip.address:80 0.0.0.0:* LISTEN 6825/nginx
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 2737/sshd
tcp 0 0 0.0.0.0:3000 0.0.0.0:* LISTEN 6389/unicorn.rb -E
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 2934/master
tcp 0 0 my.public.ip.address:443 0.0.0.0:* LISTEN 6825/nginx
tcp 0 0 my.public.ip.address:22 a.different.ip.number:49372 ESTABLISHED 3433/sshd: user
tcp 0 232 my.public.ip.address:22 a.different.ip.number:49909 ESTABLISHED 6887/sshd: user
tcp6 0 0 :::22 :::* LISTEN 2737/sshd
tcp6 0 0 :::25 :::* LISTEN 2934/master
wo es scheint, dass sowohl port 80 und 443 sind offen von nginx, aber wenn ich versuche, curl localhost:
$ curl localhost
curl: (7) Failed connect to localhost:80; Connection refused
$ curl https://localhost
curl: (7) Failed connect to localhost:443; Connection refused
den port 22 verwendet ssh scheint einwandfrei zu funktionieren. als ich angemeldet bin auf die box über ssh:
dies ist mein /etc/nginx/nginx.conf
Datei:
user www-data;
worker_processes 4;
pid /run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/app/nginx_access.log;
error_log /var/log/app/nginx_error.log;
gzip on;
gzip_disable "msie6";
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
hier ist mein /etc/nginx/sites-enabled/app
Datei:
upstream unicorn {
server 0.0.0.0:3000 fail_timeout=0;
}
server {
listen my.ip.num.ber:80;
server_name www.mydomainname.com;
location /{
rewrite ^ https://$server_name$request_uri permanent;
}
}
server {
listen my.ip.num.ber:443 ssl;
server_name www.mydomainname.com;
client_max_body_size 4G;
keepalive_timeout 5;
root /var/www/mydomainname/releases/20140417140248/public/;
try_files $uri $uri/index.html $uri.html @unicorn;
ssl_certificate /srv/ssl/mydomainname.chained.crt;
ssl_certificate_key /srv/ssl/mydomainname.key;
ssl_session_timeout 5m;
ssl_protocols SSLv2 SSLv3 TLSv1;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location /assets/{
gzip_static on;
expires max;
add_header Cache-Control public;
# alias /var/www/mydomainname/releases/20140417140248/public/;
}
location @unicorn {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_intercept_errors on;
proxy_pass http://unicorn;
}
}
aus einem scan mit nmap sehe ich:
$ sudo nmap -sS -O 127.0.0.1
Starting Nmap 6.40 ( http://nmap.org ) at 2014-04-17 14:44 UTC
Nmap scan report for localhost (127.0.0.1)
Host is up (0.000062s latency).
Not shown: 996 closed ports
PORT STATE SERVICE
22/tcp open ssh
25/tcp open smtp
3000/tcp open ppp
3306/tcp open mysql
No exact OS matches for host (If you know what OS is running on it, see http://nmap.org/submit/).
TCP/IP fingerprint:
OS:SCAN(V=6.40%E=4%D=4/17%OT=22%CT=1%CU=30717%PV=N%DS=0%DC=L%G=Y%TM=534FE8C
OS:8%P=x86_64-unknown-linux-gnu)SEQ(SP=107%GCD=1%ISR=10B%TI=Z%CI=I%II=I%TS=
OS:8)OPS(O1=MFFD7ST11NW7%O2=MFFD7ST11NW7%O3=MFFD7NNT11NW7%O4=MFFD7ST11NW7%O
OS:5=MFFD7ST11NW7%O6=MFFD7ST11)WIN(W1=AAAA%W2=AAAA%W3=AAAA%W4=AAAA%W5=AAAA%
OS:W6=AAAA)ECN(R=Y%DF=Y%T=40%W=AAAA%O=MFFD7NNSNW7%CC=Y%Q=)T1(R=Y%DF=Y%T=40%
OS:S=O%A=S+%F=AS%RD=0%Q=)T2(R=N)T3(R=N)T4(R=Y%DF=Y%T=40%W=0%S=A%A=Z%F=R%O=%
OS:RD=0%Q=)T5(R=Y%DF=Y%T=40%W=0%S=Z%A=S+%F=AR%O=%RD=0%Q=)T6(R=Y%DF=Y%T=40%W
OS:=0%S=A%A=Z%F=R%O=%RD=0%Q=)T7(R=Y%DF=Y%T=40%W=0%S=Z%A=S+%F=AR%O=%RD=0%Q=)
OS:U1(R=Y%DF=N%T=40%IPL=164%UN=0%RIPL=G%RID=G%RIPCK=G%RUCK=G%RUD=G)IE(R=Y%D
OS:FI=N%T=40%CD=S)
Network Distance: 0 hops
OS detection performed. Please report any incorrect results at http://nmap.org/submit/.
Nmap done: 1 IP address (1 host up) scanned in 12.27 seconds
irgendwelche Hinweise?
Dank
Zusatz:
nach dem Neustart mit nginx konfiguriert mit listen 80
und listen 443
, hier ist meine neue netstat:
sudo netstat -ntulp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 5664/mysqld
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 7845/nginx
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 2737/sshd
tcp 0 0 0.0.0.0:3000 0.0.0.0:* LISTEN 6389/unicorn.rb -E
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 2934/master
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 7845/nginx
tcp6 0 0 :::22 :::* LISTEN 2737/sshd
tcp6 0 0 :::25 :::* LISTEN 2934/master
udp 0 0 0.0.0.0:57284 0.0.0.0:* 2418/dhclient
udp 0 0 0.0.0.0:68 0.0.0.0:* 2418/dhclient
udp 0 0 my.public.ip.addr:123 0.0.0.0:* 3550/ntpd
udp 0 0 127.0.0.1:123 0.0.0.0:* 3550/ntpd
udp 0 0 0.0.0.0:123 0.0.0.0:* 3550/ntpd
udp6 0 0 :::55187 :::* 2418/dhclient
udp6 0 0 ::1:123 :::* 3550/ntpd
udp6 0 0 :::123 :::* 3550/ntpd
InformationsquelleAutor don giulio | 2014-04-17
Du musst angemeldet sein, um einen Kommentar abzugeben.
Ihre nginx hören
my.ip.num.ber
, aber Sie versuchen, eine Verbindung zu localhost, das ist127.0.0.1
fast immer. Ihre nginx hört nicht zu dieser ip.Entfernen Sie einfach
my.ip.num.ber
auslisten
Richtlinien. Machen Sielisten 80;
undlisten 443 ssl;
.Ich habe versucht, das entfernen der ip-Nummer aus der
/etc/nginx/sites-enabled/app
- Datei. und Neustarten von nginx. es hat nicht die situation zu verbessern.Was netstat zeigt nach dem Neustart?
aktualisiert die Beschreibung mit netstat
Tut
www.myapp.com
wird zu Recht IP-Nummer? Wahrscheinlich haben Sie einige firewall aktiviert?InformationsquelleAutor Alexey Ten
Es stellt sich heraus, dass die DNS-Konfiguration verrückt und wies meine domain woanders hin. Ich reparierte die DNS-also die Seite wird bald wieder kommen.
Dank
InformationsquelleAutor don giulio