2017-04-17 54 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文件!我看到了文件大小,只是打開了代碼檢查 - 否則我將永遠不會發現。