我在尝试将一些节点连接到 datadog 进行监控时遇到了一些问题。
我正在使用 ubuntu server 14.04.5 LTS。我添加了一个,nginx ppa:nginx/stable
所以我安装了 nginx 1.10.3。
我的 nginx 配置 /etc/nginx/sites-available/check.conf
server {
listen 80 ;
server_name localhost;
root /usr/share/nginx/html/vhosts/elbcheck/htdocs;
index index.php;
access_log off;
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location / {
try_files $uri =404;
}
location /nginx_status {
stub_status on;
access_log off;
allow 127.0.0.1;
deny all;
}
location ~ ^/(status|ping)$ {
access_log off;
allow 127.0.0.1;
deny all;
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
}
}
上述配置适用于 nginx 1.4.6,但在 nginx 1.10.3 中为空白。除了取消注释 pm.status_path 和 ping.path 之外,我还遗漏了什么步骤吗?
谢谢
答案1
我在这里找到了答案堆栈溢出
我添加了以下几行,现在又好了
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
因此完整配置将是
location ~ ^/(status|ping)$ {
access_log off;
allow 127.0.0.1;
deny all;
include fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass 127.0.0.1:9000;
}