Fixes flask website and wordpress

Signed-off-by: Bensuperpc <bensuperpc@gmail.com>
This commit is contained in:
Bensuperpc 2022-11-30 16:52:28 +01:00
parent 9d1e0bfaae
commit c41f042154
No known key found for this signature in database
GPG Key ID: D00C6B1021747EED
5 changed files with 55 additions and 18 deletions

@ -1 +1 @@
Subproject commit 859f5d387432f5e327f7f6208bda384ec8777121 Subproject commit a83b09c8143dc681be72385e7948288c6e005941

View File

@ -13,7 +13,7 @@ services:
- "80:80" - "80:80"
- "443:443" - "443:443"
volumes: volumes:
- wordpress:/var/www/worpress - wordpress:/var/www/wordpress
- jellyfin:/var/www/jellyfin - jellyfin:/var/www/jellyfin
- ./nginx-conf:/etc/nginx/conf.d - ./nginx-conf:/etc/nginx/conf.d
- certbot-cert:/etc/letsencrypt:ro - certbot-cert:/etc/letsencrypt:ro
@ -133,11 +133,11 @@ services:
- certbot - certbot
volumes: volumes:
- certbot-cert:/etc/letsencrypt - certbot-cert:/etc/letsencrypt
- wordpress:/var/www/worpress - wordpress:/var/www/wordpress
- jellyfin:/var/www/jellyfin - jellyfin:/var/www/jellyfin
#command: certonly --email bensuperpc@bensuperpc.fr --agree-tos --rsa-key-size 4096 --no-eff-email --verbose --noninteractive --staging --webroot --webroot-path=/var/www/worpress --domain bensuperpc.org --domain www.bensuperpc.org --webroot-path=/var/www/jellyfin --domain jellyfin.bensuperpc.org --domain www.jellyfin.bensuperpc.org #command: certonly --email bensuperpc@bensuperpc.fr --agree-tos --rsa-key-size 4096 --no-eff-email --verbose --noninteractive --staging --webroot --webroot-path=/var/www/wordpress --domain bensuperpc.org --domain www.bensuperpc.org --webroot-path=/var/www/jellyfin --domain jellyfin.bensuperpc.org --domain www.jellyfin.bensuperpc.org
#command: certonly --email bensuperpc@bensuperpc.fr --agree-tos --rsa-key-size 4096 --no-eff-email --verbose --force-renewal --webroot --webroot-path=/var/www/worpress --domain bensuperpc.org --domain www.bensuperpc.org --webroot-path=/var/www/jellyfin --domain jellyfin.bensuperpc.org --domain www.jellyfin.bensuperpc.org #command: certonly --email bensuperpc@bensuperpc.fr --agree-tos --rsa-key-size 4096 --no-eff-email --verbose --force-renewal --webroot --webroot-path=/var/www/wordpress --domain bensuperpc.org --domain www.bensuperpc.org --webroot-path=/var/www/jellyfin --domain jellyfin.bensuperpc.org --domain www.jellyfin.bensuperpc.org
command: certonly --email bensuperpc@bensuperpc.fr --agree-tos --rsa-key-size 4096 --no-eff-email --verbose --noninteractive --keep-until-expiring --webroot --webroot-path=/var/www/worpress --domain bensuperpc.org --domain www.bensuperpc.org --webroot-path=/var/www/jellyfin --domain jellyfin.bensuperpc.org --domain www.jellyfin.bensuperpc.org command: certonly --email bensuperpc@bensuperpc.fr --agree-tos --rsa-key-size 4096 --no-eff-email --verbose --noninteractive --keep-until-expiring --webroot --webroot-path=/var/www/wordpress --domain bensuperpc.org --domain www.bensuperpc.org --webroot-path=/var/www/jellyfin --domain jellyfin.bensuperpc.org --domain www.jellyfin.bensuperpc.org
phpmyadmin: phpmyadmin:
image: phpmyadmin:5.2.0 image: phpmyadmin:5.2.0
container_name: phpmyadmin container_name: phpmyadmin

View File

@ -8,17 +8,41 @@ upstream flask_server {
# Or: server unix:/app/flask_server.sock; # Or: server unix:/app/flask_server.sock;
} }
# Redirect all http requests to the main server wordpress_server
server { server {
listen 80; listen 80;
listen [::]:80; listen [::]:80;
#listen 443;
#listen [::]:443;
server_name flask.bensuperpc.org www.flask.bensuperpc.org; server_name wordpress.bensuperpc.org www.wordpress.bensuperpc.org;
location ~ /.well-known/acme-challenge {
allow all;
root /var/www/flask;
}
location / {
return 301 https://$host$request_uri;
}
}
server {
listen 443;
listen [::]:443;
server_name bensuperpc.org www.bensuperpc.org flask.bensuperpc.org www.flask.bensuperpc.org;
include /etc/nginx/conf.d/sub/gzip.conf; include /etc/nginx/conf.d/sub/gzip.conf;
# All things related to SSL
ssl_certificate /etc/letsencrypt/live/bensuperpc.org/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/bensuperpc.org/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/bensuperpc.org/chain.pem;
#ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
#add_header Strict-Transport-Security "max-age=31536000" always;
include /etc/nginx/conf.d/sub/options-ssl-nginx.conf;
location / { try_files $uri @flask_app; } location / { try_files $uri @flask_app; }
location @flask_app { location @flask_app {
@ -34,12 +58,23 @@ server {
uwsgi_cache_valid any 1m; uwsgi_cache_valid any 1m;
uwsgi_cache_lock on; uwsgi_cache_lock on;
#uwsgi_ignore_headers Cache-Control X-Accel-Expires Expires Vary Set-Cookie; #uwsgi_ignore_headers Vary;
#uwsgi_hide_header Vary; #uwsgi_hide_header Vary;
uwsgi_ignore_headers Vary; uwsgi_ignore_headers Expires Cache-Control Set-Cookie Vary;
uwsgi_hide_header Vary; uwsgi_hide_header Vary;
add_header X-cache $upstream_cache_status; add_header X-cache $upstream_cache_status;
} }
# Don't write to accesslog for these files
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
} }

View File

@ -97,7 +97,8 @@ server {
# Cache images # Cache images
location ~ /Items/(.*)/Images { location ~ /Items/(.*)/Images {
proxy_pass http://127.0.0.1:8096; #proxy_pass http://127.0.0.1:8096;
proxy_pass http://jellyfin_server;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
@ -129,7 +130,8 @@ server {
proxy_cache_lock on; proxy_cache_lock on;
proxy_cache_lock_age 60s; proxy_cache_lock_age 60s;
proxy_pass http://$jellyfin:8096; #proxy_pass http://$jellyfin:8096;
proxy_pass http://jellyfin_server;
proxy_cache_key "jellyvideo$uri?MediaSourceId=$arg_MediaSourceId&VideoCodec=$arg_VideoCodec&AudioCodec=$arg_AudioCodec&AudioStreamIndex=$arg_AudioStreamIndex&VideoBitrate=$arg_VideoBitrate&AudioBitrate=$arg_AudioBitrate&SubtitleMethod=$arg_SubtitleMethod&TranscodingMaxAudioChannels=$arg_TranscodingMaxAudioChannels&RequireAvc=$arg_RequireAvc&SegmentContainer=$arg_SegmentContainer&MinSegments=$arg_MinSegments&BreakOnNonKeyFrames=$arg_BreakOnNonKeyFrames&h264-profile=$h264Profile&h264-level=$h264Level&slicerange=$slice_range"; proxy_cache_key "jellyvideo$uri?MediaSourceId=$arg_MediaSourceId&VideoCodec=$arg_VideoCodec&AudioCodec=$arg_AudioCodec&AudioStreamIndex=$arg_AudioStreamIndex&VideoBitrate=$arg_VideoBitrate&AudioBitrate=$arg_AudioBitrate&SubtitleMethod=$arg_SubtitleMethod&TranscodingMaxAudioChannels=$arg_TranscodingMaxAudioChannels&RequireAvc=$arg_RequireAvc&SegmentContainer=$arg_SegmentContainer&MinSegments=$arg_MinSegments&BreakOnNonKeyFrames=$arg_BreakOnNonKeyFrames&h264-profile=$h264Profile&h264-level=$h264Level&slicerange=$slice_range";
add_header X-Cache-Status $upstream_cache_status; # This is only for debugging cache add_header X-Cache-Status $upstream_cache_status; # This is only for debugging cache

View File

@ -12,11 +12,11 @@ server {
listen 80; listen 80;
listen [::]:80; listen [::]:80;
server_name bensuperpc.org www.bensuperpc.org wordpress.bensuperpc.org www.wordpress.bensuperpc.org; server_name wordpress.bensuperpc.org www.wordpress.bensuperpc.org;
location ~ /.well-known/acme-challenge { location ~ /.well-known/acme-challenge {
allow all; allow all;
root /var/www/worpress; root /var/www/wordpress;
} }
location / { location / {
@ -28,9 +28,9 @@ server {
server { server {
listen 443 ssl http2; listen 443 ssl http2;
listen [::]:443 ssl http2; listen [::]:443 ssl http2;
server_name bensuperpc.org www.bensuperpc.org wordpress.bensuperpc.org www.wordpress.bensuperpc.org; server_name wordpress.bensuperpc.org www.wordpress.bensuperpc.org;
root /var/www/worpress; root /var/www/wordpress;
index index.php index.html index.htm; index index.php index.html index.htm;
# Keepalive for 70 seconds # Keepalive for 70 seconds