/.well-known/traffic-advice" failed (2: No such file or directory), client: 關于這個問題

網站建設 百科知道 英語/.well-known/traffic-advice" failed (2: No such file or directory), client: 關于這個問題已關閉評論206閱讀模式
遇到了這個錯誤日志:。。。。。/.well-known/traffic-advice" failed (2: No such file or directory), client: 。。。。。以下是折騰記錄。

問題分析

  1. 請求路徑:
    • 客戶端請求了?/.well-known/traffic-advice,這是一個標準的 URI 路徑,通常用于提供特定的服務或協議。
  2. 文件不存在:
    • 服務器未能找到該路徑下的文件,導致出現錯誤。

解決方案

  1. 創建缺失的文件:
    • 如果您需要這個文件來支持某些功能(例如,流量建議),請創建一個空的或包含必要內容的文件:
      touch /www/wwwroot/網站目錄/.well-known/traffic-advice
  2. 檢查配置:
    • 確保您的服務器配置允許訪問?/.well-known/?路徑。某些情況下,可能需要在 Nginx 或 Apache 配置中進行調整,以允許訪問該目錄。
  3. 忽略無關請求:
    • 如果這個請求不影響您的網站功能,并且您不需要處理這種類型的請求,可以選擇忽略這些錯誤。定期監控日志,以確保沒有其他重要問題。
  4. 設置重定向(可選):
    • 如果您希望將此請求重定向到其他有效的 URL,可以在服務器配置中添加重定向規則。

解決步驟

  1. 創建 traffic-advice 文件:
    • /.well-known/?目錄下創建一個名為?traffic-advice 的文件,內容如下:
      [{
        "user_agent": "prefetch-proxy",
        "google_prefetch_proxy_eap": {
          "fraction": 1.0
        }
      }]
      
  2. 設置 MIME 類型:
    • 您需要確保服務器返回正確的 MIME 類型。根據您使用的服務器類型,您可以選擇以下配置:
    • 對于 Apache: 在 .htaccess 文件中添加以下行:
      RewriteRule ^\.well-known/traffic-advice$ - [T=application/trafficadvice+json,END]
      
    • 對于 Nginx: 在 Nginx 配置文件中添加以下內容:
      location /.well-known/traffic-advice {
          types { } default_type "application/trafficadvice+json; charset=utf-8";
      }
      

這些是參考修改的原文:

Googlebot with name "Chrome Privacy Preserving Prefetch Proxy" tries to find instructions if it can preload your website for the user surfing on Chrome (Chrome?thinks, for example, the link to your website is going to be clicked on).

名為“Chrome Privacy Preserving Prefetch Proxy”的 Googlebot 會嘗試查找說明,以確定它是否可以為在 Chrome 上沖浪的用戶預加載您的網站(例如,Chrome?認為指向您網站的鏈接將被點擊)。

Basically what we, webmasters,?are interested in is to get rid of 404s?caused by this feature. The most simplest way is to create the file?traffic-advice?(without any extension) in the directory?.well-known?with the content:
基本上,我們網站管理員感興趣的是擺脫由此功能引起的 404。最簡單的方法是在?.well-known?目錄中創建文件?traffic-advice(不帶任何擴展名),其內容為:

[{
  "user_agent": "prefetch-proxy",
  "google_prefetch_proxy_eap": {
    "fraction": 1.0
  }
}]

Problem is that the bot requires a specific MIME type. On Apache, you can add these lines to the main?.htaccess?file:
問題是機器人需要特定的 MIME 類型。在 Apache 上,您可以將以下行添加到主?.htaccess?文件中:

RewriteRule ^\.well-known/traffic-advice$ - [T=application/trafficadvice+json,END]

On Nginx you can alter your config with these lines:
在 Nginx 上,您可以使用以下幾行更改您的配置:

# Private Prefetch Proxy
# https://developer.chrome.com/blog/private-prefetch-proxy/
location /.well-known/traffic-advice {
   types { } default_type "application/trafficadvice+json; charset=utf-8";
}

More info or advanced Nginx config can be found from the?source.
更多信息或高級 Nginx 配置可以從中找到。


如果nginx配置參數遇上這樣的問題:ERROR: nginx: [warn] the "listen ... http2" directive is deprecated, use the "http2" directive instead in /www/server/panel/vhost/nginx。。。。。。。。。。

可以參考修改:

問題 1:廢棄的 listen ... http2 指令
在較新的 Nginx 版本中,listen ... http2 指令已被廢棄,應該使用 http2 指令來代替。例如,將以下配置:

listen 443 ssl http2;

修改為:

listen 443 ssl;
http2 on;

你可以在以下文件中(相關網站的配置文件)進行相應的修改:

/www/server/panel/vhost/nginx/相關網站1.conf

/www/server/panel/vhost/nginx/相關網站2.conf

問題 2:location 指令的位置不正確
location 指令不能直接放在 nginx.conf 文件中,它必須位于 server 塊內。確保你的 location 指令正確嵌套在 server 塊中。例如,以下配置是正確的(只是參考位置):

server {
    listen 80;
    server_name example.com;

    location / {
        root /var/www/html;
        index index.html index.htm;
    }
}

確保在你的 /www/server/nginx/conf/nginx.conf 文件中將 location 指令放在 server 塊內。

完成配置更改后,建議重啟或重新加載 Nginx 以使更改生效。

 
  • 本文由 米粒在線 發表于 2024年12月30日10:24:19
  • 轉載請務必保留本文鏈接:http://www.bjmhhq.com/129264.html
實用軟件

winsxs太大了怎么清理

win系統盤空間越來越少,發現winsxs超大。winsxs太大了,怎么清理呢?顯然直接刪除這個winsxs文件夾是不行的,這是系統文件夾,直接刪除會造成系統損壞。那怎么辦,總不能看著...