Skip to content

Instantly share code, notes, and snippets.

@lazyfrosch
Last active April 3, 2020 10:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lazyfrosch/7fe8319ce3288636713529f9f7a67886 to your computer and use it in GitHub Desktop.
Save lazyfrosch/7fe8319ce3288636713529f9f7a67886 to your computer and use it in GitHub Desktop.
Icinga2 proxy through Nginx
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.html;
server_name icinga.example.com;
location ~ ^/icinga2 {
return 301 https://$server_name$request_uri;
}
# any other config
}
server {
listen 443 ssl default_server;
listen [::]:443 ssl default_server;
ssl_certificate /etc/nginx/certs/icinga.example.com.full.crt;
ssl_certificate_key /etc/nginx/certs/icinga.example.com.key;
root /var/www/html;
index index.html;
server_name icinga.example.com;
location = /icinga2 {
return 301 /icinga2/;
}
location /icinga2/ {
proxy_pass https://127.0.0.1:5665/;
proxy_ssl_trusted_certificate /var/lib/icinga2/certs/ca.crt;
proxy_http_version 1.1;
include proxy_params;
}
# any other config
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment