cn:ccr:security:howto:nginx-reverse-proxy
Differences
This shows you the differences between two versions of the page.
cn:ccr:security:howto:nginx-reverse-proxy [2022/11/02 16:40] – created enrico@infn.it | cn:ccr:security:howto:nginx-reverse-proxy [2022/11/02 16:41] (current) – enrico@infn.it | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== NGINX Reverse Proxy ====== | ||
+ | |||
+ | Per proteggere adeguatamente servizi web " | ||
+ | |||
+ | Qui di seguito la configurazione di un server web NGINX messa a protezione di un servizio di tipo shell-in-a-box su un server CentOS 7.9.2009 | ||
+ | |||
+ | ===== Installazione di NGINX ===== | ||
+ | |||
+ | Il pacchetto per CentOS è disponibile nel repository EPEL | ||
+ | |||
+ | yum install -y epel-release | ||
+ | yum install -y nginx | ||
+ | | ||
+ | La configurazione è nei vari files presenti in /etc/nginx ed in / | ||
+ | |||
+ | Il file / | ||
+ | |||
+ | < | ||
+ | server { | ||
+ | listen 80; | ||
+ | server_name login.le.infn.it; | ||
+ | return 301 https:// | ||
+ | |||
+ | access_log | ||
+ | error_log | ||
+ | |||
+ | } | ||
+ | |||
+ | server { | ||
+ | listen | ||
+ | server_name | ||
+ | | ||
+ | access_log | ||
+ | error_log | ||
+ | | ||
+ | ssl_certificate | ||
+ | ssl_certificate_key "/ | ||
+ | ssl_protocols TLSv1.2 TLSv1.3; | ||
+ | ssl_ciphers ' | ||
+ | ssl_prefer_server_ciphers on; | ||
+ | | ||
+ | location / { | ||
+ | proxy_pass http:// | ||
+ | proxy_set_header Host $host; | ||
+ | proxy_set_header X-Real-IP $remote_addr; | ||
+ | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
+ | proxy_set_header X-Forwarded-Proto $scheme; | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | A questo punto basta istruire il server " | ||
+ | |||
+ | < | ||
+ | # Shell in a box daemon configuration | ||
+ | # For details see shellinaboxd man page | ||
+ | |||
+ | # Basic options | ||
+ | USER=shellinabox | ||
+ | GROUP=shellinabox | ||
+ | CERTDIR=/ | ||
+ | PORT=4443 | ||
+ | OPTS=" | ||
+ | |||
+ | </ | ||
+ | |||
+ | |||