2017-04-17 53 views
0

该网站多年来没有问题的工作。我逐步执行更新,但这次它完全搞砸了。现在我得到默认的“welcome to Nginx”页面。我再次检查了我所有的文件夹位置等,但无法弄清楚。不知道是什么导致这个breakdonw。我将所有内容都追溯到了确切的文件夹位置。有趣的是,我找不到默认的Nginx页面的index.html。我现在在Nginx的1.12.0和Debian 8.7Nginx更新后 - 网站破碎

这里是通过conf

server { 
    listen 80; 
    server_name NAME.com www.NAME.com; 
    return 301 https://$host$request_uri; 
} 

server { 
    listen 443 ssl http2; 
    #server_name NAME.com www.NAME.com; 
    root /usr/share/nginx/html; 
    index index.html index.htm; 

    ssl_certificate /etc/letsencrypt/live/NAME.com/fullchain.pem; 
    ssl_certificate_key /etc/letsencrypt/live/NAME.com/privkey.pem; 

    ssl_protocols TLSv1.1 TLSv1.2; 
    ssl_ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:RSA+AESGCM:RSA+AES:!aNULL:!MD5:!DSS; 
    ssl_prefer_server_ciphers On; 
    ssl_session_cache shared:SSL:128m; 
    add_header Strict-Transport-Security "max-age=31557600; includeSubDomains"; 
    ssl_stapling on; 
    ssl_stapling_verify on; 

    index index.html index.htm;  

    location/{ 
    try_files $uri $uri/ =404; 
    } 

    location ^~ /.well-known/ { 
    allow all; 
    } 

    location ~* \.(ico|css|js|svg|gif|jpeg|jpg|png)$ { 
    expires 30d; 
    add_header Pragma public; 
    add_header Cache-Control "public"; 
    access_log off; 
    log_not_found off; 
    } 

    gzip on; 
    gzip_comp_level 1; 
    gzip_min_length 1000; 
    gzip_proxied  expired no-cache no-store private auth; 
    gzip_types  text/plain application/javascript application/x-javascript text/javascript text/xml text/css; 
    gzip_disable "MSIE [1-6]\."; 
    gzip_vary on; 
    gzip_buffers 16 8k; 

    server_tokens off; 
    add_header X-Frame-Options SAMEORIGIN; 
    add_header X-XSS-Protection "1; mode=block"; 
} 

最后这里是nginx.conf

user nginx; 
worker_processes 1; 

error_log /var/log/nginx/error.log warn; 
pid  /var/run/nginx.pid; 


events { 
    worker_connections 65536; 
    use epoll; 
    multi_accept on; 
} 


http { 
    include  /etc/nginx/mime.types; 
    default_type application/octet-stream; 

    log_format main '$remote_addr - $remote_user [$time_local] "$request" ' 
         '$status $body_bytes_sent "$http_referer" ' 
         '"$http_user_agent" "$http_x_forwarded_for"'; 
    access_log /var/log/nginx/access.log main; 

    #sendfile  on; 
    tcp_nopush  on; 
    tcp_nodelay on; 

    client_body_timeout 3m; 
    client_header_timeout 3m; 
    keepalive_timeout 40; 
    send_timeout 3m; 

    include /etc/nginx/conf.d/default.conf; 
} 

回答

0

您在端口服务器块没有server_name 443.你确定这是服务于你的请求的服务器块吗?
检查/etc/nginx/sites-enabled中的默认文件。它的关键字default_server在其listen指令。

+0

是啊很确定这是服务器块。我没有注意到这条线,我记得几个月前取消注释引起的问题。我没有/ etc/nginx/sites-enabled文件夹。 –

+0

那么你的服务器块的文件位置是什么?该目录中是否有其他配置文件? – Pharaoh

+0

我检查了/ usr/local/nginx/conf和/ usr/local/etc/nginx - 没有配置文件。唯一的位置是服务器块:/etc/nginx/conf.d/default.conf Nginx config:/etc/nginx/nginx.conf –

0

CRAZY - 所以它看起来像NGINX更新时,它将index.html文件替换为默认的“welcome to Nginx”html文件。我有一个备份,所以我幸运,但什么废话。为什么他们会替换index.html文件!我看到了文件大小,只是打开了代码检查 - 否则我将永远不会发现。