Guest User

nginx.conf

a guest
Aug 8th, 2023
1,010
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nginx 1.96 KB | Source Code | 0 0
  1. user nginx;
  2. worker_processes auto;
  3. error_log /var/log/nginx/error.log;
  4. pid /run/nginx.pid;
  5.  
  6. events {
  7.     worker_connections 1024;
  8. }
  9.  
  10. http {
  11.  
  12.     sendfile            on;
  13.     tcp_nopush          on;
  14.     tcp_nodelay         on;
  15.     keepalive_timeout   65;
  16.     types_hash_max_size 2048;
  17.     resolver 1.1.1.1;
  18.  
  19.     include             /etc/nginx/mime.types;
  20.     default_type        application/octet-stream;
  21.  
  22.     proxy_cache_path /var/cache/nginx/ keys_zone=cache:20m inactive=1y max_size=30g;
  23.  
  24.     server {
  25.         server_name media.mastodong.lol;
  26.         listen [2602:fe90:2:5dd::368d]:80;
  27.         listen [2602:fe90:2:5dd::368d]:443 ssl http2;
  28.         listen 2.56.173.221:80;
  29.         listen 2.56.173.221:443 ssl http2;
  30.  
  31.         #listen [::]:80;
  32.         #listen [::]:443 ssl http2;
  33.         #listen 0.0.0.0:80;
  34.         #listen 0.0.0.0:443 ssl http2;
  35.  
  36.         ssl_certificate /etc/letsencrypt/live/media.mastodong.lol/fullchain.pem;
  37.         ssl_certificate_key /etc/letsencrypt/live/media.mastodong.lol/privkey.pem;
  38.  
  39.         location /.well-known/ {
  40.             root /var/www/html/;
  41.             try_files $uri =404;
  42.         }
  43.  
  44.         location = /system/site_uploads/files/000/000/002/@1x/1ee66ad374404372.png {
  45.             return 301 https://files.catbox.moe/nd6pyz.webp;
  46.         }
  47.  
  48.         location /system {
  49.             limit_except GET {
  50.                 deny all;
  51.             }
  52.  
  53.             proxy_ssl_server_name on;
  54.             proxy_set_header Host mastodong.lol;
  55.             proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  56.             proxy_pass https://mastodong.lol$request_uri;
  57.             proxy_intercept_errors off;
  58.  
  59.             proxy_cache cache;
  60.             proxy_cache_valid 200 1y;
  61.             proxy_cache_lock on;
  62.             proxy_cache_lock_age 1m;
  63.             proxy_cache_lock_timeout 1m;
  64.             proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
  65.             proxy_ignore_headers Expires Cache-Control;
  66.             proxy_hide_header Expires;
  67.             proxy_hide_header Cache-Control;
  68.             #proxy_cache_revalidate on;
  69.             #proxy_no_cache $http_content_length='0';
  70.  
  71.             expires 1y;
  72.             add_header Access-Control-Allow-Origin *;
  73.             add_header X-Cache-Status $upstream_cache_status;
  74.         }
  75.     }
  76. }
Tags: nginx
Add Comment
Please, Sign In to add comment