Advertisement
enoch85

Untitled

Nov 22nd, 2016
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nginx 6.66 KB | None | 0 0
  1. ########## APACHE #############
  2.  
  3. <VirtualHost 192.168.4.111:443>
  4.     Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"
  5.     Header always set X-Content-Type-Options nosniff
  6.     SSLEngine on
  7.  
  8. ### YOUR SERVER ADDRESS ###
  9.     ServerAdmin daniel@techandme.se
  10.     ServerName cloud.techandme.se
  11.  
  12. ### SETTINGS ###
  13.     DocumentRoot /var/www/nextcloud
  14.  
  15.     <Directory /var/www/nextcloud>
  16.     Options Indexes FollowSymLinks
  17.     AllowOverride All
  18.     Require all granted
  19.     Satisfy Any
  20.     </Directory>
  21.  
  22.     <IfModule mod_dav.c>
  23.     Dav off
  24.     </IfModule>
  25.  
  26.     <Directory "/var/ncdata">
  27.     # just in case if .htaccess gets disabled
  28.     Require all denied
  29.     </Directory>
  30.  
  31. ### SSL CONFIG ###
  32.  
  33.     SSLCertificateFile /etc/ssl/techandme/techandme_wild.pem
  34.     SSLCertificateKeyFile /etc/ssl/techandme/techandme_wild.key
  35.  
  36. ### OFFICE ###
  37.  
  38.   # Encoded slashes need to be allowed
  39.   AllowEncodedSlashes On
  40.  
  41.   # Container uses a unique non-signed certificate
  42. #  SSLProxyEngine On
  43.   SSLProxyVerify None
  44.   SSLProxyCheckPeerCN Off
  45.   SSLProxyCheckPeerName Off
  46.  
  47.   # keep the host
  48.   ProxyPreserveHost On
  49.  
  50.   # static html, js, images, etc. served from loolwsd
  51.   # loleaflet is the client part of LibreOffice Online
  52.   ProxyPass           /loleaflet https://192.168.4.111:9980/loleaflet retry=0
  53.   ProxyPassReverse    /loleaflet https://192.168.4.111:9980/loleaflet
  54.  
  55.   # WOPI discovery URL
  56.   ProxyPass           /hosting/discovery https://192.168.4.111:9980/hosting/discovery retry=0
  57.   ProxyPassReverse    /hosting/discovery https://192.168.4.111:9980/hosting/discovery
  58.  
  59.   # Main websocket
  60.   ProxyPassMatch "/lool/(.*)/ws$" wss://192.168.4.111:9980/lool/$1/ws
  61.  
  62.   # Admin Console websocket
  63.   ProxyPass   /lool/adminws wss://192.168.4.111:9980/lool/adminws
  64.  
  65.   # Download as, Fullscreen presentation and Image upload operations
  66.   ProxyPass           /lool https://192.168.4.111:9980/lool
  67.   ProxyPassReverse    /lool https://192.168.4.111:9980/lool
  68.  
  69.  
  70. </VirtualHost>
  71.  
  72.  
  73. ########## NGINX #############
  74.  
  75. server {
  76.         # Cloudflare IP that is masked by mod_real_ip
  77.  
  78.     error_page 404 500 502 503 504 /cloud-error.html;
  79.         location = /cloud-error.html {
  80.                 root /usr/share/nginx/html;
  81.                 internal;
  82.         }
  83.         set_real_ip_from 103.21.244.0/22;
  84.         set_real_ip_from 103.22.200.0/22;
  85.         set_real_ip_from 103.31.4.0/22;
  86.         set_real_ip_from 104.16.0.0/12;
  87.         set_real_ip_from 108.162.192.0/18;
  88.         set_real_ip_from 131.0.72.0/22;
  89.         set_real_ip_from 141.101.64.0/18;
  90.         set_real_ip_from 162.158.0.0/15;
  91.         set_real_ip_from 172.64.0.0/13;
  92.         set_real_ip_from 173.245.48.0/20;
  93.         set_real_ip_from 188.114.96.0/20;
  94.         set_real_ip_from 190.93.240.0/20;
  95.         set_real_ip_from 197.234.240.0/22;
  96.         set_real_ip_from 198.41.128.0/17;
  97.         set_real_ip_from 199.27.128.0/21;
  98.  
  99.     real_ip_header     X-Forwarded-For;
  100.         real_ip_recursive  on;
  101.  
  102.         listen 192.168.4.201:443 ssl http2;
  103.  
  104.         ssl on;
  105.         ssl_certificate /etc/nginx/ssl/techandme/techandme_wild.pem;
  106.         ssl_certificate_key /etc/nginx/ssl/techandme/techandme_wild.key;
  107. #        ssl_certificate /etc/letsencrypt/live/cloud.techandme.se/fullchain.pem;
  108. #        ssl_certificate_key /etc/letsencrypt/live/cloud.techandme.se/privkey.pem;
  109.     ssl_dhparam /etc/nginx/sites-available/cloudflare_ip/cloud.techandme/cloud-dhparams.pem;
  110.         ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  111.         ssl_session_timeout 1d;
  112.         ssl_session_cache shared:SSL:10m;
  113.         ssl_stapling on;
  114.         ssl_stapling_verify on;
  115.  
  116.         # Only use safe chiphers
  117.     ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';
  118.     ssl_prefer_server_ciphers on;
  119.    
  120.     # Add secure headers
  121.     add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload";
  122.  
  123.    
  124.         server_name cloud.techandme.se;
  125.         set $upstream 192.168.4.111:443;
  126.  
  127. ## Collabora ##
  128.  
  129.         location ^~ /loleaflet {
  130.                 proxy_pass https://$upstream:9980;
  131.                 proxy_set_header Host $http_host;
  132.         }
  133.  
  134.         location ^~ /hosting/discovery {
  135.                 proxy_pass https://$upstream:9980;
  136.                 proxy_set_header Host $http_host;
  137.         }
  138.  
  139.         location ^~ /lool {
  140.                 proxy_pass https://$upstream:9980;
  141.                 proxy_set_header Upgrade $http_upgrade;
  142.                 proxy_set_header Connection "upgrade";
  143.                 proxy_set_header Host $http_host;
  144.         }
  145.  
  146. ## Spreed ME ##
  147.  
  148.         location /webrtc/ws {
  149.                 proxy_pass https://$upstream;
  150.                 proxy_http_version 1.1;
  151.                 proxy_set_header Upgrade $http_upgrade;
  152.                 proxy_set_header Connection "upgrade";
  153.         proxy_set_header Host $http_host;
  154.         proxy_set_header X-Real-IP $remote_addr;
  155.         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  156.         proxy_buffering             on;
  157.         proxy_ignore_client_abort   off;
  158.         proxy_redirect              off;
  159.         proxy_connect_timeout       90;
  160.         proxy_send_timeout          90;
  161.         proxy_read_timeout          90;
  162.         proxy_buffer_size           4k;
  163.         proxy_buffers               4 32k;
  164.         proxy_busy_buffers_size     64k;
  165.         proxy_temp_file_write_size  64k;
  166.         }
  167.  
  168. ## Nextcloud ##
  169.  
  170.         location / {
  171.                 proxy_pass_header Authorization;
  172.                 proxy_pass https://$upstream;
  173.                 proxy_set_header Host $host;
  174.                 proxy_set_header X-Real-IP  $remote_addr;
  175.                 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  176.                 proxy_http_version 1.1;
  177.                 proxy_set_header Connection "";
  178.                 proxy_buffering off;
  179.                 proxy_request_buffering off;
  180.         client_max_body_size 0;
  181.                 proxy_read_timeout  36000s;
  182.                 proxy_redirect off;
  183.                 proxy_ssl_session_reuse off;
  184.         }
  185. }
  186.  
  187. ## Redirect ##
  188.  
  189. server {
  190.   listen 192.168.4.201:80;
  191.   server_name cloud.techandme.se;
  192.   return 301 https://cloud.techandme.se$request_uri;
  193. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement