Skip to content
Snippets Groups Projects
Select Git revision
  • 9fa76c4c2038a776cc94af5d9f307bbaad52083c
  • master default protected
  • add-metadata-cleaner-link
  • fix-key-error-for-svg-without-xmlns
  • factorize
  • ppt
  • patch-1
  • pdf_depth
  • fix_testsuite
  • add_wav_support
  • please_mypy
  • improve_zip
  • improve_images
  • improve_svg
  • inverted_backup
  • bak
  • elementary-contract
  • implement_lightweight_mode_msoffice
  • 0.11.0
  • 0.10.1
  • 0.10.0
  • 0.9.0
  • 0.8.0
  • 0.7.0
  • 0.6.0
  • 0.5.0
  • 0.4.0
  • 0.3.1
  • 0.3.0
  • 0.2.0
  • 0.1.3
  • 0.1.2
  • 0.1.1
  • 0.1.0
34 results

main.py

Blame
  • Forked from jvoisin / mat2
    Source project has a limited visibility.
    nginx.conf 7.32 KiB
    
    user www-data www-data;
    
    worker_processes 8;
    
    pid /var/run/nginx.pid;
    
    events {
        worker_connections 768;
        multi_accept on;
        use epoll;
    }
    
    http {
        ##
        # Basic Settings
        ##
    
        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;
        types_hash_max_size 2048;
        server_tokens off;
    
        server_names_hash_max_size 2048;
        server_names_hash_bucket_size 64;
        # server_name_in_redirect off;
    
        include mime.types;
        default_type application/octet-stream;
        
        # default charset
        charset utf-8;
    
        ##
        # Some of SSL settings are in snippets/ssl.conf
        # included in all ssl-enabled hosts
        ##
    
        # Mozilla SSL Intermediate profile
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers 'ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS';
        ssl_prefer_server_ciphers on;
        
        # cache SSL sessions for 10m (this is about 40,000 sessions), timing them out
        # after 24 hours.
        # https://sethvargo.com/getting-an-a-plus-on-qualys-ssl-labs-tester/
        ssl_session_cache shared:SSL:10m;
        ssl_session_timeout 24h;
    
        # set the buffer size to 1400 bytes (that way it fits into a single MTU).
        ssl_buffer_size 1400;
    
        # this is generated in docker/nginx/run.sh
        ssl_dhparam '/etc/ssl/nginx/dhparam.pem';
    
        ##
        # Default Logging Settings
        ##
    
        access_log /srv/logs/nginx/access.log combined;
        error_log /srv/logs/nginx/error.log;
        
        ######################################################################
        ## Various configuration sections:                                  ##
        ######################################################################
        
        ##
        # Gzip Settings
        ##
    
        gzip on;
        gzip_disable "msie6";
    
        gzip_vary on;
        gzip_proxied any;
        gzip_comp_level 6;
        gzip_buffers 16 8k;
        gzip_http_version 1.1;
        gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript image/svg+xml;
    
        
        ##
        # Size Limits & Buffer Overflows
        ##
    
        #client_header_buffer_size 1k;
        client_max_body_size 20m;
        client_body_buffer_size 1m;
        #large_client_header_buffers 2 1k;
    
        ##
        # Start: Timeouts
        ##
        client_body_timeout   10;
        client_header_timeout 10;
        keepalive_timeout     5 5;
        send_timeout  10;
    
        # Directive describes the zone, in which the session states are stored i.e. store in slimits.
        # 1m can handle 32000 sessions with 32 bytes/session, set to 5m x 32000 session
        # limit_conn_zone $binary_remote_addr zone=slimits:5m;
    
        # Control maximum number of simultaneous connections for one session i.e.
        # restricts the amount of connections from a single ip address
        # limit_conn slimits 5;
    
    
        # 
        # rate limiting
        # https://www.nginx.com/blog/rate-limiting-nginx/
        # https://nginx.org/en/docs/http/ngx_http_limit_req_module.html
        # 
        # just add "limit_req zone=ddosed burst=100;" in any location
        # that is supposed to be rate-limited
        limit_req_zone $binary_remote_addr zone=ddosed:20m rate=10r/s;
    
        ##
        #  Proxy cache settings
        ##
    
        # keys_zone=fasada:10m - how long the cache is considered fresh
        # max_size=3G          - we're fine with large cache size on disk
        # inactive=12h         - stale cached content is retained in cache for 12h at least
        #                        this is necessary if we want to be able to serve stale content
        #                        in case of errors longer than the time the cache is considered "fresh"
        #                        which we do -- this gives us the ability to survive a backend crash
        #                        with most users not noticing
        proxy_cache_path /srv/data/cache/nginx/proxy/ levels=1:2 keys_zone=fasada:10m max_size=3G inactive=12h;
    
        #
        # A cached response is first written to a temporary file, and then the file is renamed.
        # Starting from version 0.8.9, temporary files and the cache can be put on different file systems.
        # However, be aware that in this case a file is copied across two file systems instead of
        # the cheap renaming operation. It is thus recommended that for any given location both
        # cache and a directory holding temporary files are put on the same file system. The directory
        # for temporary files is set based on the use_temp_path parameter (1.7.10).
        #
        proxy_temp_path /srv/data/cache/nginx/tmp/ 1 2;
    
        # no fastcgi around
        #fastcgi_cache_path /srv/data/cache/nginx/fastcgi/ levels=1:2 keys_zone=fastcgicache:100m max_size=5G;
    
        proxy_cache_key $scheme:$request_method:$host/$uri$is_args$args;
        # no fastcgi around
        #fastcgi_cache_key "$proxy_host|$request_method|$scheme|$host|$request_uri|$is_args|$args|$cookie_user|$cookie_phpsessid";
    
        # by default, bypass the cache when:
        # - Pragma: no-cache is present
        # - any cookie is present
        proxy_cache_bypass $http_pragma $http_cookie;
    
        proxy_set_header Host $http_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_intercept_errors on;
        proxy_buffering on;
        proxy_buffer_size 128k;
        proxy_buffers 256 16k;
        proxy_busy_buffers_size 256k;
        proxy_temp_file_write_size 256k;
        proxy_max_temp_file_size 0;
    
        # Defines a timeout for establishing a connection with a proxied server.
        # It should be noted that this timeout cannot usually exceed 75 seconds.
        # 
        # This should be short; we want the back-end to time-out before the client
        # connection does. This way the visitor receives a cached version instead
        # of a generic timeout
        proxy_connect_timeout   2;
    
        # Sets a timeout for transmitting a request to the proxied server.
        # The timeout is set only between two successive write operations,
        # not for the transmission of the whole request.
        # If the proxied server does not receive anything within this time,
        # the connection is closed. 
        proxy_send_timeout      120;
    
        # Defines a timeout for reading a response from the proxied server.
        # The timeout is set only between two successive read operations,
        # not for the transmission of the whole response.
        # If the proxied server does not transmit anything within this time,
        # the connection is closed. 
        proxy_read_timeout      5;
    
        
        # redirect map in http block - remove fbclid argument from the end
        # context:
        # https://gist.github.com/lynt-smitka/b5ff2cab70443c17a214006a4d5bc48c
        # https://community.cloudflare.com/t/facebook-now-adds-fbclid-query-string-to-urls-busting-cloudflares-cache/40355
        map $request_uri $redirect_fbclid {
            "~^(.*?)([?&]fbclid=[a-zA-Z0-9_-]+)$"  $1;
        }
    
        
        ##
        # Virtual Host Configs
        ##
    
        include sites/*.conf;
    }