
Create a new password file:
htpasswd -c /etc/nginx/.htpasswd eddy
Add another users:htpasswd /etc/nginx/.htpasswd anna
All usernames and encrypted passwords can be observer:cat /etc/nginx/.htpasswd
Set the right owner:chown nginx:nginx /etc/nginx/.htpasswd
Allow the file to not be redable from others:chmod 0660 /etc/nginx/.htpasswd
cat <<'EOF' > /etc/nginx/conf.d/zbx-ssl.conf
server {
auth_basic "Restricted Content";
auth_basic_user_file /etc/nginx/.htpasswd;
listen 443 ssl;
ssl on;
ssl_certificate /etc/ssl/certs/zabbix.pem;
ssl_certificate_key /etc/ssl/private/zabbix.key;
ssl_dhparam /etc/ssl/private/dhparam.pem;
listen 80;
server_name zabbix;
root /usr/share;
index index.php;
location ~ .php$ {
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share$fastcgi_script_name;
include fastcgi_params;
fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
}
}
EOF
systemctl reload nginx
No comments:
Post a Comment