Hi,
Yes I fixed the certificate but I didnt use Certbot I generated the certificate and changed the config file manually.
the complete out of nginx.conf:
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 768;
}
http {
lua_shared_dict prometheus_metrics 20M;
lua_package_path '/home/farbod/lua/?.lua;;';
init_by_lua_block {
prometheus = require("prometheus").init("prometheus_metrics")
http_requests = prometheus:counter(
"nginx_http_requests", "Number of HTTP requests", {"host", "status"})
http_request_time = prometheus:histogram(
"nginx_http_request_time", "HTTP request time", {"host"})
http_connections = prometheus:gauge(
"nginx_http_connections", "Number of HTTP connections", {"state"})
http_upstream_cache_status = prometheus:counter(
"nginx_http_upstream_cache_status", "Number of HTTP upstream cache status", {"host", "status"})
http_upstream_requests = prometheus:counter(
"nginx_http_upstream_requests", "Number of HTTP upstream requests", {"host", "addr", "status"})
http_upstream_response_time = prometheus:histogram(
"nginx_http_upstream_response_time", "HTTP upstream response time", {"host", "addr"})
http_upstream_header_time = prometheus:histogram(
"nginx_http_upstream_header_time", "HTTP upstream header time", {"host", "addr"})
http_upstream_connect_time = prometheus:histogram(
"nginx_http_upstream_connect_time", "HTTP upstream connect time", {"host", "addr"})
}
log_by_lua_block {
local function split(str)
local array = {}
for mem in string.gmatch(str, '([^, ]+)') do
table.insert(array, mem)
end
return array
end
local function getWithIndex(str, idx)
if str == nil then
return nil
end
return split(str)[idx]
end
local host = ngx.var.host
local status = ngx.var.status
http_requests:inc(1, {host, status})
http_request_time:observe(ngx.now() - ngx.req.start_time(), {host})
local upstream_cache_status = ngx.var.upstream_cache_status
if upstream_cache_status ~= nil then
http_upstream_cache_status:inc(1, {host, upstream_cache_status})
end
local upstream_addr = ngx.var.upstream_addr
if upstream_addr ~= nil then
local addrs = split(upstream_addr)
local upstream_status = ngx.var.upstream_status
local upstream_response_time = ngx.var.upstream_response_time
local upstream_connect_time = ngx.var.upstream_connect_time
local upstream_header_time = ngx.var.upstream_header_time
-- compatible for nginx commas format
for idx, addr in ipairs(addrs) do
if table.getn(addrs) > 1 then
upstream_status_code = getWithIndex(ngx.var.upstream_status, idx)
upstream_response_time = getWithIndex(ngx.var.upstream_response_time, idx)
upstream_connect_time = getWithIndex(ngx.var.upstream_connect_time, idx)
upstream_header_time = getWithIndex(ngx.var.upstream_header_time, idx)
end
if upstream_status_code ~= nil then
http_upstream_requests:inc(1, {host, addr, upstream_status_code})
end
if upstream_response_time ~= nil and tonumber(upstream_response_time) ~= nil then
http_upstream_response_time:observe(tonumber(upstream_response_time), {host, addr})
http_upstream_header_time:observe(tonumber(upstream_header_time), {host, addr})
http_upstream_connect_time:observe(tonumber(upstream_connect_time), {host, addr})
end
end
end
}
map $uri basename {
~/(?<captured_basename>[^/]*) $captured_basename;
}
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
sendfile on;
sendfile_max_chunk 512k;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# SSL Settings
##
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}