Centos
為什麼 apache 會導致 DNS 查找失敗?
一個 CentOS 7 網路伺服器有 Tomcat 在 apache httpd 反向代理後面提供戰爭文件。當 WAR 文件都是伺服器端程式碼時,這非常有效。但是,當客戶端程式碼(在本例中為 AngularJS)與伺服器端程式碼一起包含在 war 文件中時,當
domain3.com
在 Web 瀏覽器中鍵入應用程序中核心 html 文件的每個依賴項時,apache httpd 2.4 會引發以下代理錯誤:[proxy:error] AH00898: DNS lookup failure for: resources returned by /res$
為了確認這是 apache 錯誤而不是 tomcat 錯誤,我在 firewalld 中為應用程序打開了 8084 埠,然後載入
domain3.com:8084
以發現應用程序執行良好,包括其客戶端 AngularJS 程式碼。需要進行哪些配置更改才能使 apache httpd 2.4 在
domain3.com
向 Web 瀏覽器中鍵入請求時為包含在戰爭中的客戶端應用程序提供包含內容?此類事務的完整 httpd 日誌
domain3.com
是:[Tue Nov 03 14:31:57.662516 2015] [proxy:error] [pid 9332] [client client.ip.addr:57369] AH00898: DNS lookup failure for: server.ip.addr:8013resources returned by /res$ [Tue Nov 03 14:31:57.747345 2015] [proxy:error] [pid 9332] [client client.ip.addr:57369] AH00898: DNS lookup failure for: server.ip.addr:8013resources returned by /res$ [Tue Nov 03 14:31:57.752815 2015] [proxy:error] [pid 9294] [client client.ip.addr:57370] AH00898: DNS lookup failure for: server.ip.addr:8013js returned by /js/lib/ang$ [Tue Nov 03 14:31:57.757663 2015] [proxy:error] [pid 11936] [client client.ip.addr:57372] AH00898: DNS lookup failure for: server.ip.addr:8013js returned by /js/lib/an$ [Tue Nov 03 14:31:57.758121 2015] [proxy:error] [pid 4325] [client client.ip.addr:57371] AH00898: DNS lookup failure for: server.ip.addr:8013js returned by /js/lib/ang$ [Tue Nov 03 14:31:57.758509 2015] [proxy:error] [pid 23006] [client client.ip.addr:57373] AH00898: DNS lookup failure for: server.ip.addr:8013js returned by /js/lib/an$ [Tue Nov 03 14:31:57.762749 2015] [proxy:error] [pid 9325] [client client.ip.addr:57374] AH00898: DNS lookup failure for: server.ip.addr:8013js returned by /js/lib/ang$ [Tue Nov 03 14:31:57.829953 2015] [proxy:error] [pid 9332] [client client.ip.addr:57369] AH00898: DNS lookup failure for: server.ip.addr:8013js returned by /js/lib/ang$ [Tue Nov 03 14:31:57.846174 2015] [proxy:error] [pid 9294] [client client.ip.addr:57370] AH00898: DNS lookup failure for: server.ip.addr:8013js returned by /js/lib/ang$ [Tue Nov 03 14:31:57.851022 2015] [proxy:error] [pid 4325] [client client.ip.addr:57371] AH00898: DNS lookup failure for: server.ip.addr:8013somecontroller.js returned$ [Tue Nov 03 14:31:58.049885 2015] [proxy:error] [pid 9332] [client client.ip.addr:57369] AH00898: DNS lookup failure for: server.ip.addr:8013js returned by /js/lib/ang$ [Tue Nov 03 14:31:58.207199 2015] [proxy:error] [pid 9332] [client client.ip.addr:57369] AH00898: DNS lookup failure for: server.ip.addr:8013js returned by /js/lib/ang$ [Tue Nov 03 14:31:58.320704 2015] [proxy:error] [pid 9332] [client client.ip.addr:57369] AH00898: DNS lookup failure for: server.ip.addr:8013js returned by /js/lib/ang$ [Tue Nov 03 14:31:58.428737 2015] [proxy:error] [pid 9332] [client client.ip.addr:57369] AH00898: DNS lookup failure for: server.ip.addr:8013js returned by /js/lib/ang$ [Tue Nov 03 14:31:58.523564 2015] [proxy:error] [pid 9332] [client client.ip.addr:57369] AH00898: DNS lookup failure for: server.ip.addr:8013js returned by /js/lib/ang$ [Tue Nov 03 14:31:58.611546 2015] [proxy:error] [pid 9332] [client client.ip.addr:57369] AH00898: DNS lookup failure for: server.ip.addr:8013js returned by /js/lib/ang$ [Tue Nov 03 14:31:58.708439 2015] [proxy:error] [pid 9332] [client client.ip.addr:57369] AH00898: DNS lookup failure for: server.ip.addr:8013somecontroller.js returned$
同一
domain3.com
事務的 tomcat 日誌僅顯示一個成功的 GET 請求:client.ip.addr - - [03/Nov/2015:14:31:57 -0500] "GET / HTTP/1.1" 200 2944
客戶端將這些視為依賴項的 502 錯誤,而不是 502 錯誤
index.html
,這是唯一正確提供的資源。的相關部分
/etc/httpd/conf.d/virtualhosts.conf
是:<VirtualHost www.domain3.com:80> ServerName www.domain3.com ServerAlias domain3.com ErrorLog /var/log/httpd/domain3_com_error.log CustomLog /var/log/httpd/domain3_com_requests.log combined ProxyPass / ajp://server.ip.addr:8013 ProxyPassReverse / ajp://server.ip.addr:8013 </VirtualHost>
那麼,為了
httpd
在應用程序的客戶端部分中提供對包含文件的請求,我應該進行哪些更改domain3.com
?
將缺少的斜杠添加到您的
ProxyPass
和ProxyPassReverse
指令中:ProxyPass / ajp://server.ip.addr:8013/ ProxyPassReverse / ajp://server.ip.addr:8013/