# Requires nginx >=1.4. # Based on bakape and bakaonto's example configurations. upstream node { # Endpoint of the doushio node.js server server 127.0.0.1:8000; # Or if using a unix domain socket: #server unix:/path/to/unix/domain/socket; } access_log /var/log/nginx/doushio.log; # Additional WebSocket proxying support. map $http_upgrade $connection_upgrade { default upgrade; '' close; } server { listen 80; # Domain the website will be hosted on. server_name mydomain.com; # You can forward various root-directory static files here. root /path/to/doushio/www/; location = /favicon.ico {} location = /robots.txt {} # Handles static assets (images, JS, CSS, etc.) # Requires "SERVE_STATIC_FILES: false" in ./config.js # Set imager/config MEDIA_URL to '/ass/'. # The trailing "/" is important. location /ass/ { alias /path/to/doushio/www/; expires 2d; add_header X-Content-Type-Options nosniff; } # Handles image uploads. location /upload/ { # If you use imager/config DAEMON, add an upstream for the # imager daemon, and point this at it. proxy_pass http://node/upload/; # For forwarding IPs: # Set "TRUST_X_FORWARDED_FOR: true" in ./config.js proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; #proxy_set_header X-Forwarded-For $http_cf_connecting_ip; # CloudFlare # Adjust this to your imager/config IMAGE_FILESIZE_MAX. client_max_body_size 5m; # Allow for prolonged uploads. client_body_timeout 300s; # This may give you more accurate upload progress. #proxy_buffering off; } # Handles the imageboard. location / { proxy_pass http://node; proxy_buffering off; # WebSockets support. proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; #proxy_set_header X-Forwarded-For $http_cf_connecting_ip; # CloudFlare } }