#user nobody; worker_processes 1; # This default error log path is compiled-in to make sure configuration parsing # errors are logged somewhere, especially during unattended boot when stderr # isn't normally logged anywhere. This path will be touched on every nginx # start regardless of error log location configured here. See # https://trac.nginx.org/nginx/ticket/147 for more info. # #error_log /var/log/nginx/error.log; # #pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; server { # You would want to make a separate file with its own server block for each virtual domain # on your server and then include them. listen 80; #tells Nginx the hostname and the TCP port where it should listen for HTTP connections. # listen 80; is equivalent to listen *:80; return 301 https://$host$request_uri; #charset koi8-r; #access_log logs/host.access.log main; #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } # HTTPS server # server { listen 443 ssl; server_name domain.com; ssl_certificate /usr/local/etc/letsencrypt/live/domain.com-0001/fullchain.pem; # managed by Certbot ssl_certificate_key /usr/local/etc/letsencrypt/live/domain.com-0001/privkey.pem; # managed by Certbot ssl_session_cache shared:SSL:1m; ssl_session_timeout 5m; ssl_ciphers HIGH:!aNULL:!MD5; ssl_prefer_server_ciphers on; location / { root /usr/local/www/nginx; index index.html index.htm; } } server { listen 443 ssl; server_name nextcloud.domain.com; ssl_certificate /usr/local/etc/letsencrypt/live/domain.com-0001/fullchain.pem; # managed by Certbot ssl_certificate_key /usr/local/etc/letsencrypt/live/domain.com-0001/privkey.pem; # managed by Certbot ssl_session_cache shared:SSL:1m; ssl_session_timeout 5m; ssl_ciphers HIGH:!aNULL:!MD5; ssl_prefer_server_ciphers on; proxy_buffering off; client_max_body_size 10G; location / { 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_set_header X-Forwarded-Host $server_name; proxy_set_header X-Forwarded-Ssl on; proxy_pass https://ip_of_truenas:8283/; proxy_read_timeout 600; # proxy_redirect off; } location /.well-known/carddav { return 301 $scheme://$host/remote.php/dav; } location /.well-known/caldav { return 301 $scheme://$host/remote.php/dav; } } }