Nginx

會話文件每 2 秒創建一次。在 openshift Laravel PHP nginx haproxy 上執行

  • July 27, 2016

伺服器啟動時訪問伺服器的原因是什麼?

我已經rhc tail在我的應用程序上執行以監控新日誌。

這是我的日誌 http://laravel.io/bin/Dez4o


當我使用啟動應用程序時rhc app-start

應用程序根/日誌/php-fpm-error.log

[26-Jul-2016 21:53:00] NOTICE: [pool www] 'user' directive is ignored     
when FPM is not running as root
[26-Jul-2016 21:53:00] NOTICE: [pool www] 'group' directive is ignored
when FPM is not running as root
[26-Jul-2016 21:53:00] NOTICE: fpm is running, pid 33590
[26-Jul-2016 21:53:00] NOTICE: ready to handle connections

應用程序根/日誌/haproxy.log

[WARNING] 207/215259 (33493) : config : log format ignored for proxy 'stats' since it has no log address.
[WARNING] 207/215259 (33493) : config : log format ignored for proxy 'express' since it has no log address.
[WARNING] 207/215259 (33493) : Server express/local-gear is DOWN, reason: Layer4 connection problem, info: "Connection refused", check duration: 0ms. 0 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.
[ALERT] 207/215259 (33493) : proxy 'express' has no server available!

應用程序根/日誌/haproxy_ctld.log

I, [2016-07-26T21:52:59.962585 #33508]  INFO -- : Starting haproxy_ctld

nginx/logs/error.log

2016/07/26 21:53:03 [warn] 36575#0: the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /var/lib/openshift/578775d489f5cf4fc100019f/nginx//conf/nginx.conf:2

應用程序根/日誌/nginx_access.log

(my.sever.ip.address) - - [26/Jul/2016:21:53:06 -0400]  302 "GET / HTTP/1.0" 364 "-" "-" "-"
(my.sever.ip.address) - - [26/Jul/2016:21:53:08 -0400]  302 "GET / HTTP/1.0" 364 "-" "-" "-"
(my.sever.ip.address) - - [26/Jul/2016:21:53:10 -0400]  302 "GET / HTTP/1.0" 364 "-" "-" "-"

應用程序根/日誌/haproxy.log

[WARNING] 207/215310 (33493) : Server express/local-gear is UP, reason: Layer7 check passed, code: 302, info: "HTTP status check returned code <3C>302<3E>", check duration: 69ms. 1 active and 0 backup servers online. 0 sessions requeued, 0 total in queue.

應用程序根/日誌/nginx_access.log

(my.sever.ip.address) - - [26/Jul/2016:21:53:12 -0400]  302 "GET / HTTP/1.0" 364 "-" "-" "-"
(my.sever.ip.address) - - [26/Jul/2016:21:53:14 -0400]  302 "GET / HTTP/1.0" 364 "-" "-" "-"
(my.sever.ip.address) - - [26/Jul/2016:21:53:16 -0400]  302 "GET / HTTP/1.0" 364 "-" "-" "-"
(my.sever.ip.address) - - [26/Jul/2016:21:53:18 -0400]  302 "GET / HTTP/1.0" 364 "-" "-" "-"
(my.sever.ip.address) - - [26/Jul/2016:21:53:20 -0400]  302 "GET / HTTP/1.0" 364 "-" "-" "-"
(my.sever.ip.address) - - [26/Jul/2016:21:53:22 -0400]  302 "GET / HTTP/1.0" 364 "-" "-" "-"

然後我嘗試訪問我的網站根目錄

(my.sever.ip.address) - - [26/Jul/2016:21:53:24 -0400]  200 "GET /login HTTP/1.1" 1422 "-" "Mozilla/5.0 (Windows NT 6.2; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0" "(my.client.ip.address)"
(my.sever.ip.address) - - [26/Jul/2016:21:53:24 -0400]  302 "GET / HTTP/1.0" 364 "-" "-" "-"
(my.sever.ip.address) - - [26/Jul/2016:21:53:25 -0400]  200 "GET /components/AdminLTE/bootstrap/css/bootstrap.min.css HTTP/1.1" 23930 "http://dev-teleradportal.rhcloud.com/login" "Mozilla/5.0 (Windows NT 6.2; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0" "(my.client.ip.address)"
(my.sever.ip.address) - - [26/Jul/2016:21:53:25 -0400]  200 "GET /components/AdminLTE/plugins/font-awesome/css/font-awesome.min.css HTTP/1.1" 6734 "http://dev-teleradportal.rhcloud.com/login" "Mozilla/5.0 (Windows NT 6.2; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0" "(my.client.ip.address)"
... other assets

但載入後日誌繼續

(my.sever.ip.address) - - [26/Jul/2016:21:53:26 -0400]  302 "GET / HTTP/1.0" 364 "-" "-" "-"
(my.sever.ip.address) - - [26/Jul/2016:21:53:29 -0400]  302 "GET / HTTP/1.0" 364 "-" "-" "-"
(my.sever.ip.address) - - [26/Jul/2016:21:53:31 -0400]  302 "GET / HTTP/1.0" 364 "-" "-" "-"
(my.sever.ip.address) - - [26/Jul/2016:21:53:33 -0400]  302 "GET / HTTP/1.0" 364 "-" "-" "-"

然後我執行了rhc app-stop停止伺服器

這些是執行“停止”後的日誌

應用程序根/日誌/php-fpm-error.log

[26-Jul-2016 21:53:55] NOTICE: Terminating ...
[26-Jul-2016 21:53:55] NOTICE: exiting, bye-bye!

nginx/logs/error.log

2016/07/26 21:53:55 [warn] 37102#0: the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /var/lib/openshift/578775d489f5cf4fc100019f/nginx//conf/nginx.conf:2
2016/07/26 21:53:55 [notice] 37102#0: signal process started

access logs

所描述的行為與 haproxy 的 http 健康檢查相匹配。創建新會話是因為 haproxy 不會在健康檢查之間保留 cookie,因此您的應用程序 (Laravel) 將請求視為新瀏覽會話的第一個請求。

您可以將您的健康檢查 url 重新配置為不使用會話的東西以避免創建會話文件,但這意味著即使會話功能被破壞,健康檢查也會通過。

“inter”參數將兩次連續健康檢查之間的間隔設置為毫秒。如果未指定,則延遲預設為 2000 毫秒。

來源:http ://cbonte.github.io/haproxy-dconv/1.6/snapshot/configuration.html#inter

引用自:https://serverfault.com/questions/792150