Added some reverse proxy scripts
This commit is contained in:
parent
7d38d85f68
commit
89731fc1e5
2 changed files with 63 additions and 0 deletions
60
create_reverse_proxy.sh
Executable file
60
create_reverse_proxy.sh
Executable file
|
|
@ -0,0 +1,60 @@
|
|||
#!/bin/bash
|
||||
|
||||
export NEXTCLOUD_URL=nextcloud.adamhome.dev
|
||||
export APACHE_PORT=11000
|
||||
export APACHE_COMM=127.0.0.1
|
||||
|
||||
###### FOR NGINX
|
||||
|
||||
cat << EOT >> /tmp/nginx_nextcloud.txt
|
||||
map $http_upgrade $connection_upgrade {
|
||||
default upgrade;
|
||||
'' close;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80; # comment to disable IPv6
|
||||
|
||||
if ($scheme = "http") {
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
|
||||
listen 443 ssl http2;
|
||||
listen [::]:443 ssl http2; # comment to disable IPv6
|
||||
|
||||
server_name ${NEXTCLOUD_URL};
|
||||
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:11000$request_uri;
|
||||
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Port $server_port;
|
||||
proxy_set_header X-Forwarded-Scheme $scheme;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header Accept-Encoding "";
|
||||
proxy_set_header Host $host;
|
||||
|
||||
client_body_buffer_size 512k;
|
||||
proxy_read_timeout 86400s;
|
||||
client_max_body_size 0;
|
||||
|
||||
# Websocket
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
}
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/${NEXTCLOUD_URL}/fullchain.pem; # managed by certbot on host machine
|
||||
ssl_certificate_key /etc/letsencrypt/live/${NEXTCLOUD_URL}/privkey.pem; # managed by certbot on host machine
|
||||
|
||||
ssl_session_timeout 1d;
|
||||
ssl_session_cache shared:MozSSL:10m; # about 40000 sessions
|
||||
ssl_session_tickets off;
|
||||
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
|
||||
ssl_prefer_server_ciphers off;
|
||||
}
|
||||
EOT
|
||||
3
reverse_proxy.sh
Executable file
3
reverse_proxy.sh
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
|
||||
deb http://nginx.org/packages/mainline/ubuntu/ CODENAME nginx
|
||||
Loading…
Add table
Add a link
Reference in a new issue