Added combined seafile and jellyfin nginx conf
This commit is contained in:
		
							parent
							
								
									570bfd4c29
								
							
						
					
					
						commit
						2902a042e7
					
				
					 2 changed files with 175 additions and 65 deletions
				
			
		| 
						 | 
				
			
			@ -1,65 +0,0 @@
 | 
			
		|||
worker_processes auto;
 | 
			
		||||
 | 
			
		||||
error_log /var/log/nginx/error.log notice;
 | 
			
		||||
pid /tmp/nginx.pid;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
events
 | 
			
		||||
{
 | 
			
		||||
        worker_connections 1024;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
http
 | 
			
		||||
{
 | 
			
		||||
        proxy_temp_path /tmp/proxy_temp;
 | 
			
		||||
        client_body_temp_path /tmp/client_temp;
 | 
			
		||||
        fastcgi_temp_path /tmp/fastcgi_temp;
 | 
			
		||||
        uwsgi_temp_path /tmp/uwsgi_temp;
 | 
			
		||||
        scgi_temp_path /tmp/scgi_temp;
 | 
			
		||||
 | 
			
		||||
        include /etc/nginx/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 /var/log/nginx/access.log main;
 | 
			
		||||
 | 
			
		||||
        sendfile on;
 | 
			
		||||
        #tcp_nopush     on;
 | 
			
		||||
 | 
			
		||||
        keepalive_timeout 65;
 | 
			
		||||
 | 
			
		||||
        #gzip  on;
 | 
			
		||||
 | 
			
		||||
        include /etc/nginx/conf.d/*.conf;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        server
 | 
			
		||||
        {
 | 
			
		||||
                listen 8443 ssl;
 | 
			
		||||
                listen [::]:8443 ssl;
 | 
			
		||||
                ssl_certificate /etc/nginx/ssl/cert.pem;
 | 
			
		||||
                ssl_certificate_key /etc/nginx/ssl/key.pem;
 | 
			
		||||
                server_name localhost seafile.homelab0ne.xyz;
 | 
			
		||||
                location / 
 | 
			
		||||
                {
 | 
			
		||||
                       proxy_pass http://seafile:80;
 | 
			
		||||
                       proxy_set_header X-Forwarded-For $remote_addr;
 | 
			
		||||
                       proxy_set_header X-Forwarded-Proto $scheme;
 | 
			
		||||
                       proxy_set_header Host $host;
 | 
			
		||||
                       proxy_set_header Origin 'https://seafile.homelab0ne.xyz';
 | 
			
		||||
        # Nginx by default only allows file uploads up to 1M in size
 | 
			
		||||
        # Increase client_max_body_size to match max_upload_size defined in homeserver.yaml
 | 
			
		||||
                       client_max_body_size 50M;
 | 
			
		||||
                       proxy_http_version 1.1;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										175
									
								
								config/nginx/seafile_and_jellyfin.conf
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										175
									
								
								config/nginx/seafile_and_jellyfin.conf
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,175 @@
 | 
			
		|||
worker_processes auto;
 | 
			
		||||
 | 
			
		||||
error_log /var/log/nginx/error.log notice;
 | 
			
		||||
pid /tmp/nginx.pid;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
events
 | 
			
		||||
{
 | 
			
		||||
        worker_connections 1024;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
http
 | 
			
		||||
{
 | 
			
		||||
        proxy_temp_path /tmp/proxy_temp;
 | 
			
		||||
        client_body_temp_path /tmp/client_temp;
 | 
			
		||||
        fastcgi_temp_path /tmp/fastcgi_temp;
 | 
			
		||||
        uwsgi_temp_path /tmp/uwsgi_temp;
 | 
			
		||||
        scgi_temp_path /tmp/scgi_temp;
 | 
			
		||||
 | 
			
		||||
        include /etc/nginx/mime.types;
 | 
			
		||||
        default_type application/octet-stream;
 | 
			
		||||
 | 
			
		||||
        log_format main '$remote_addr - $remote_user [$time_local] "$request" '
 | 
			
		||||
        #        log_format main '$proxy_protocol_addr - $remote_user [$time_local] "$request" '
 | 
			
		||||
        '$status $body_bytes_sent "$http_referer" '
 | 
			
		||||
        '"$http_user_agent" "$http_x_forwarded_for"';
 | 
			
		||||
 | 
			
		||||
        access_log /var/log/nginx/access.log main;
 | 
			
		||||
 | 
			
		||||
        sendfile on;
 | 
			
		||||
        #tcp_nopush     on;
 | 
			
		||||
 | 
			
		||||
        keepalive_timeout 65;
 | 
			
		||||
 | 
			
		||||
        #gzip  on;
 | 
			
		||||
 | 
			
		||||
        include /etc/nginx/conf.d/*.conf;
 | 
			
		||||
 | 
			
		||||
        server
 | 
			
		||||
        {
 | 
			
		||||
                listen 8080;
 | 
			
		||||
                listen [::]:8080;
 | 
			
		||||
                server_name seafile.homelab0ne.xyz jellyfin.homelab0ne.xyz;
 | 
			
		||||
 | 
			
		||||
                return 301 https://$host$request_uri;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        server
 | 
			
		||||
        {
 | 
			
		||||
                listen 8444 ssl proxy_protocol;
 | 
			
		||||
                listen [::]:8444 ssl proxy_protocol;
 | 
			
		||||
                ssl_certificate /etc/nginx/ssl/cert.pem;
 | 
			
		||||
                ssl_certificate_key /etc/nginx/ssl/key.pem;
 | 
			
		||||
                server_name seafile.homelab0ne.xyz;
 | 
			
		||||
                port_in_redirect off;
 | 
			
		||||
                #                set_real_ip_from 10.0.0.21/24;
 | 
			
		||||
                #$proxy_protocol_addr;
 | 
			
		||||
                location /
 | 
			
		||||
                {
 | 
			
		||||
 | 
			
		||||
                        if ($request_method = 'OPTIONS')
 | 
			
		||||
                        {
 | 
			
		||||
                                add_header 'Access-Control-Allow-Origin' '*';
 | 
			
		||||
                                add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
 | 
			
		||||
                                #
 | 
			
		||||
                                # Custom headers and headers various browsers *should* be OK with but aren't
 | 
			
		||||
                                #
 | 
			
		||||
                                add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
 | 
			
		||||
                                #
 | 
			
		||||
                                # Tell client that this pre-flight info is valid for 20 days
 | 
			
		||||
                                #
 | 
			
		||||
                                add_header 'Access-Control-Max-Age' 1728000;
 | 
			
		||||
                                add_header 'Content-Type' 'text/plain; charset=utf-8';
 | 
			
		||||
                                add_header 'Content-Length' 0;
 | 
			
		||||
                                return 204;
 | 
			
		||||
                        }
 | 
			
		||||
                        if ($request_method = 'POST')
 | 
			
		||||
                        {
 | 
			
		||||
                                add_header 'Access-Control-Allow-Origin' '*' always;
 | 
			
		||||
                                add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
 | 
			
		||||
                                add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range' always;
 | 
			
		||||
                                add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always;
 | 
			
		||||
                        }
 | 
			
		||||
                        if ($request_method = 'GET')
 | 
			
		||||
                        {
 | 
			
		||||
                                add_header 'Access-Control-Allow-Origin' '*' always;
 | 
			
		||||
                                add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
 | 
			
		||||
                                add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range' always;
 | 
			
		||||
                                add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always;
 | 
			
		||||
                        }
 | 
			
		||||
                        proxy_pass http://seafile:80;
 | 
			
		||||
                        proxy_set_header X-Forwarded-For $remote_addr;
 | 
			
		||||
                        proxy_set_header X-Forwarded-Proto $scheme;
 | 
			
		||||
                        proxy_set_header Host $host;
 | 
			
		||||
                        proxy_set_header Origin 'https://seafile.homelab0ne.xyz';
 | 
			
		||||
                        # Nginx by default only allows file uploads up to 1M in size
 | 
			
		||||
                        # Increase client_max_body_size to match max_upload_size defined in homeserver.yaml
 | 
			
		||||
                        client_max_body_size 50M;
 | 
			
		||||
                        proxy_http_version 1.1;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#               location /seafdav
 | 
			
		||||
#               {
 | 
			
		||||
#                       rewrite ^/seafdav$ /seafdav/ permanent;
 | 
			
		||||
#               }
 | 
			
		||||
#               location /seafdav/ {
 | 
			
		||||
#                       proxy_pass http://seafile:8080/seafdav/;
 | 
			
		||||
#                       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-Host $server_name;
 | 
			
		||||
#                       proxy_set_header   X-Forwarded-Proto $scheme;
 | 
			
		||||
#                       proxy_read_timeout  1200s;
 | 
			
		||||
#                       client_max_body_size 0;
 | 
			
		||||
#                       access_log      /var/log/nginx/seafdav.access.log seafileformat;
 | 
			
		||||
#                       error_log       /var/log/nginx/seafdav.error.log;
 | 
			
		||||
#               }
 | 
			
		||||
 | 
			
		||||
#               location /:dir_browser {
 | 
			
		||||
#                       proxy_pass         http://seafile:8080/:dir_browser;
 | 
			
		||||
#               }
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        server
 | 
			
		||||
        {
 | 
			
		||||
 | 
			
		||||
                listen 8444 ssl proxy_protocol;
 | 
			
		||||
                listen 8443 ssl;
 | 
			
		||||
                #               listen [::]:8443 ssl;
 | 
			
		||||
                #               listen [::]:8444 ssl proxy_protocol;
 | 
			
		||||
                http2 on;
 | 
			
		||||
                server_name jellyfin.homelab0ne.xyz;
 | 
			
		||||
                client_max_body_size 20M;
 | 
			
		||||
                ssl_certificate /etc/nginx/ssl/cert.pem;
 | 
			
		||||
                ssl_certificate_key /etc/nginx/ssl/key.pem;
 | 
			
		||||
                ssl_protocols TLSv1.3 TLSv1.2;
 | 
			
		||||
                add_header X-Frame-Options "SAMEORIGIN";
 | 
			
		||||
                add_header X-XSS-Protection "0"; # Do NOT enable. This is obsolete/dangerous
 | 
			
		||||
                add_header X-Content-Type-Options "nosniff";
 | 
			
		||||
                add_header Permissions-Policy "accelerometer=(), ambient-light-sensor=(), battery=(), bluetooth=(), camera=(), clipboard-read=(), display-capture=(), document-domain=(), encrypted-media=(), gamepad=(), geolocation=(), gyroscope=(), hid=(), idle-detection=(), interest-cohort=(), keyboard-map=(), local-fonts=(), magnetometer=(), microphone=(), payment=(), publickey-credentials-get=(), serial=(), sync-xhr=(), usb=(), xr-spatial-tracking=()" always;
 | 
			
		||||
                add_header Content-Security-Policy "default-src https: data: blob: ; img-src 'self' https://* ; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' https://www.gstatic.com https://www.youtube.com blob:; worker-src 'self' blob:; connect-src 'self'; object-src 'none'; frame-ancestors 'self'";
 | 
			
		||||
 | 
			
		||||
                location /
 | 
			
		||||
                {
 | 
			
		||||
                        proxy_pass http://jellyfin:8096;
 | 
			
		||||
                        proxy_set_header Host $host;
 | 
			
		||||
                        #                       proxy_set_header X-Real-IP $proxy_protocol_addr;
 | 
			
		||||
                        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
 | 
			
		||||
                        proxy_set_header X-Forwarded-Proto $scheme;
 | 
			
		||||
                        proxy_set_header X-Forwarded-Protocol $scheme;
 | 
			
		||||
                        proxy_set_header X-Forwarded-Host $http_host;
 | 
			
		||||
                        proxy_buffering off;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                location /socket
 | 
			
		||||
                {
 | 
			
		||||
                        proxy_pass http://jellyfin:8096;
 | 
			
		||||
                        proxy_http_version 1.1;
 | 
			
		||||
                        proxy_set_header Upgrade $http_upgrade;
 | 
			
		||||
                        proxy_set_header Connection "upgrade";
 | 
			
		||||
                        proxy_set_header Host $host;
 | 
			
		||||
                        #                       proxy_set_header X-Real-IP $proxy_protocol_addr;
 | 
			
		||||
                        #                      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
 | 
			
		||||
                        proxy_set_header X-Forwarded-Proto $scheme;
 | 
			
		||||
                        proxy_set_header X-Forwarded-Protocol $scheme;
 | 
			
		||||
                        proxy_set_header X-Forwarded-Host $http_host;
 | 
			
		||||
                }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue