[ prog / sol / mona ]

prog


How can I run my own instance of this

143 2020-04-11 02:04 *

>>140,142
You'll also probably want to serve static files directly with nginx, even if SchemeBBS can serve them too. And you probably want to cache requests. So, here's a fairly complete nginx.conf:

http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile       on;
    tcp_nopush     on;
    tcp_nodelay    on;
    keepalive_timeout  65;

    proxy_cache_path /var/cache/nginx levels=1:2
    keys_zone=cache:10m inactive=600s max_size=100m;
    #limit post requests
    map $request_method $limit {
        default "";
        POST $binary_remote_addr;
    }
    # Creates 10mb zone in memory for storing binary ips
    limit_req_zone $limit zone=post_limit:10m rate=11r/m;

    upstream http_backend {
        keepalive 20;
        server 127.0.0.1:8080;
    }
    server {
        listen 80;
        server_name tld.org www.tld.org;
        set $prefix "/path/to/schemebbs"

        # site root, a static page
        location = / {
            rewrite ^ /static/index.html;
        }
        location = /favicon.ico {
            rewrite ^ /static/favicon.ico;
        }
        # static files
        location /static/ {
            alias $prefix/static/;
        }
        # serve s-expressions as static files
        location /sexp {
                alias $prefix/data/sexp/;
                autoindex on;
                default_type text/x-scheme;
                fancyindex on;
                fancyindex_time_format "%F %R";
                fancyindex_footer "/static/lisp.html";
        }
        location / {
            root   $prefix/data/html;
            default_type text/html;
            index  index;
            try_files $uri $uri/index @schemebbs;
        }
        #replace css and add query string to all internal links
        #snippet above goes here

        location @schemebbs {
            proxy_intercept_errors on;
            proxy_http_version 1.1; 
            proxy_set_header Connection "";
            proxy_set_header Accept-Encoding "";
            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_cache cache;
            proxy_cache_key $scheme$host$request_method$request_uri;
            proxy_cache_valid 200 30s;
            proxy_pass http://http_backend;
        }

        error_page 400 /400.html;
        error_page 403 /403.html;
        error_page 404 /404.html;
        error_page 405 /405.html;
        error_page 500 /500.html;
        error_page 502 /502.html;
        error_page 503 /503.html;
        error_page 504 /504.html;
        error_page 429 /429.html;

        location ~ ^/(400|403|404|405|429|500|502|503|504)\.html {
            root $prefix/static/errors;
        }

    }#end server
}#end http

301


VIP:

do not edit these