我的服務器是工作非常精細,直到幾個小時前,在某種程度上它停止接聽來電話,Nginx的偵聽的端口80或443,但沒有響應
我盤算了一下,麒麟工作正常(捲曲本地主機:3000作品 - 其中3000是麒麟的端口)
我跑:
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
它似乎這兩個端口80和443是由nginx的開放,但是當我嘗試捲曲本地主機:
$ curl localhost
curl: (7) Failed connect to localhost:80; Connection refused
$ curl https://localhost
curl: (7) Failed connect to localhost:443; Connection refused
由ssh使用的端口22似乎工作正常。因爲我通過ssh登錄的對話框:
這是我/etc/nginx/nginx.conf
文件:
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/*;
}
這裏是我的/etc/nginx/sites-enabled/app
文件:
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;
}
}
從使用nmap掃描我看到:
$ 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
任何線索?
感謝
增加:
nginx的與listen 80
和listen 443
配置重新啓動後,這裏是我的新的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
雖然當我嘗試從我的電腦 –
捲曲my.ip.num.ber我試圖從'的/ etc/nginx的/啓用的站點 - /應用程序刪除IP數它甚至不工作'文件。並重新啓動nginx。它沒有改善這種情況。 –
重啓後netstat顯示了什麼? –