Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- domain=domain.com
- declare -A map
- map[adm]=8021
- map[web]=8022
- map[cms]=8023
- cp proxy{,.bak$(date +'%y%m%d.%H%M%S')} 2>/dev/null
- : > proxy
- for i in ${!map[@]}; do
- fqdn=$i.${domain}
- cat >> proxy <<EOF
- server { # 127.0.0.1:${map[$i]}
- listen 443 ssl;
- server_name ${fqdn};
- ssl_certificate cert/${fqdn}.crt;
- ssl_certificate_key cert/${fqdn}.key;
- location / {
- proxy_pass http://127.0.0.1:${map[$i]};
- proxy_set_header Host \$host;
- proxy_set_header X-Real-IP \$remote_addr;
- }
- }
- server {
- listen 80;
- server_name ${fqdn};
- return 301 https://${fqdn}\$request_uri;
- }
- EOF
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement