Skip to content

Instantly share code, notes, and snippets.

@zipang
Created December 7, 2017 12:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zipang/3d60db9c29cb9a5db7ec3f431d07279b to your computer and use it in GitHub Desktop.
Save zipang/3d60db9c29cb9a5db7ec3f431d07279b to your computer and use it in GitHub Desktop.
Nginx configuration file for a nodebb forum with http2 enabled
server {
server_name forum.mathforu.com;
listen 80;
return 301 https://\$host\$request_uri;
}
server {
server_name forum.mathforu.com;
listen 443 ssl http2;
ssl_certificate /etc/nginx/certs/mathforu.bundle.crt;
ssl_certificate_key /etc/nginx/certs/mathforu.com.key;
location @nodebb {
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_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://127.0.0.1:4567;
proxy_redirect off;
# Socket.IO Support
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location ~ ^/assets/(.*) {
root /var/www/mathforu-forum/nodebb/;
try_files /build/public/$1 /public/$1 @nodebb;
}
location /plugins/ {
root /var/www/mathforu-forum/nodebb/build/public/;
try_files $uri @nodebb;
}
location / {
try_files $uri @nodebb;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment