-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreverse_proxy_nginx_ssl
48 lines (40 loc) · 2.36 KB
/
reverse_proxy_nginx_ssl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
metricbeat setup
filebeat setup
echo "-------------------------------------------------------"
echo "System is going update and upgrade, Please wait a while"
echo "-------------------------------------------------------"
echo "Installing Nginx and the 'apache2-utils' packages to the system"
sudo apt install nginx apache2-utils -y
touch /etc/nginx/sites-available/kibana
wget -O /etc/nginx/sites-available/kibana https://raw.githubusercontent.com/aftab70/mycodes/master/kibana_reverse_proxy_with_ssl
htpasswd -c /etc/nginx/.kibana-user admin_kib@na $p
ln -s /etc/nginx/sites-available/kibana /etc/nginx/sites-enabled/
touch /etc/nginx/sites-available/elastic
wget -O /etc/nginx/sites-available/elastic https://raw.githubusercontent.com/aftab70/java/master/nginx_elastic_reverse_proxy
htpasswd -c /etc/nginx/.elastic; admin_el@stic $p
ln -s /etc/nginx/sites-available/elastic /etc/nginx/sites-enabled/
systemctl enable nginx
systemctl restart nginx
echo "-----------------------------------------------------------"
echo " Self Signed SSL configuration started, Please wait a while"
echo "-----------------------------------------------------------"
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/nginx-selfsigned.key -out /etc/ssl/certs/nginx-selfsigned.crt
openssl dhparam -out /etc/nginx/dhparam.pem 4096
touch /etc/nginx/snippets/self-signed.conf
echo "ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;" > /etc/nginx/snippets/self-signed.conf
echo "ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key;" >> /etc/nginx/snippets/self-signed.conf
touch /etc/nginx/snippets/ssl-params.conf
wget -O /etc/nginx/snippets/ssl-params.conf https://raw.githubusercontent.com/aftab70/java/master/ssl_param_nginx
nginx -t
systemctl restart nginx
ufw allow 443
echo "-----------------------------------------------------------"
echo "- -"
echo "- Elasticsearch and Kibana Setup Complete -"
echo "- -"
echo "- You can access kibana on https://IP_or_localhost -"
echo "- Username: ************ -"
echo "- Password: *********** -"
echo "- -"
echo "----- -----------------------------------------------------"