“Nginx Reverse Proxy NextCloud” Ответ

Nginx Reverse Proxy NextCloud

//This use case assumes you are using a docker container.
//If not you can change the ip information too

server {
    listen 80;
    server_name domain.com;
    return 301 https://$server_name$request_uri;
}

server {
    listen 443 ssl;
    server_name domain.com ;

/**If you are using letsencrypt with default file locations
Use "certbot certonly -d domain.com" to generate the ssl certs
remember to turn off your nginx before generating ssl certs**/
    ssl_certificate /etc/letsencrypt/live/domain.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/domain.com/privkey.pem;

    add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;

    ssl_session_cache shared:SSL:10m;
    ssl_protocols TLSv1.2;
    ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256';
    ssl_prefer_server_ciphers on;

    client_max_body_size 2048M;


    location / {
	proxy_pass http://172.0.0.1:8080;
	proxy_set_header        Host $host;
	proxy_set_header        X-Real-IP $remote_addr;
	proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
	proxy_set_header        X-Forwarded-Proto $scheme;
	proxy_read_timeout 300;
    }

    location /.well-known/carddav {
    return 301 $scheme://$host/remote.php/dav;
    }

    location /.well-known/caldav {
    return 301 $scheme://$host/remote.php/dav;
    }
Justmarije

Nginx Reverse Proxy NextCloud

/**
Add this to config.php (in /nextcloud/config/config.php)
to make the nextcloud instance aware of being in a proxy
and using correct information when making URLs
**/

'trusted_proxies'   => ['172.0.0.1'],
  'overwritehost'     => 'domain.com',
  'overwriteprotocol' => 'https',
  'overwritecondaddr' => '^172\.0\.0\.1$',
Justmarije

Ответы похожие на “Nginx Reverse Proxy NextCloud”

Смотреть популярные ответы по языку

Смотреть другие языки программирования