Node.js based forum software built for the modern web
proxies init
psychobunny054f53410856
diff --git a/docs/configuring/proxies.rst b/docs/configuring/proxies.rstindex adbd8c37ea..2f5587550c 100644--- a/docs/configuring/proxies.rst+++ b/docs/configuring/proxies.rst@@ -1,11 +1,16 @@Configuring Web Server / Proxies================================+Here a few options that you can use to proxy your NodeBB forum.-testing+.. toctree::+ :hidden:+ :maxdepth: 0+ Nginx <proxies/nginx>+ Apache <proxies/apache>+ Varnish Cache <proxies/varnish>-testing----------testing\ No newline at end of file+* :doc:`Nginx <proxies/nginx>`+* :doc:`Apache <proxies/apache>`+* :doc:`Varnish Cache <proxies/varnish>`\ No newline at end of filediff --git a/docs/configuring/proxies/apache.rst b/docs/configuring/proxies/apache.rstnew file mode 100644index 0000000000..96eec21f2d--- /dev/null+++ b/docs/configuring/proxies/apache.rst@@ -0,0 +1,68 @@+# Prerequisites to making this work:+Apache 2.4.x++### What if I'm on 2.2.x (Debian/Ubuntu)?++you need to manually compile and add the module "mod_proxy_wstunnel" to the Apache 2.2 branch. If you're running Ubuntu or Debian, you're likely on the 2.2 branch of code.++The following guide will assist with that if you're on Debian or Ubuntu. This is what I used to backport the mod_proxy_wstunnel module to the 2.2 code base of Apache;++http://www.amoss.me.uk/2013/06/apache-2-2-websocket-proxying-ubuntu-mod_proxy_wstunnel/++#### NOTE: On ubuntu, if you’re missing the ./configure file+You need to first run ./buildconf. After this is complete, you will then be able to use ./confugure.++>automake & libtool package was needed too.+>apt-get install automake libtool++****+# Enable the necessary modules++1. sudo a2enmod proxy+2. sudo a2enmod proxy_html+3. sudo a2enmod proxy_wstunnel++## Add the config to Apache++The next step is adding the configuration to your virtualhost.conf file, typically located in /etc/apache2/sites-available/. The below configuration assumes you've used 4567 (default) port for NobeBB installation. It also assumes you have the bind address set to 127.0.0.1.++ ProxyRequests off++ <Proxy *>+ Order deny,allow+ Allow from all+ </Proxy>+ ProxyPass /socket.io/1/websocket ws://127.0.0.1:4567/socket.io/1/websocket+ ProxyPassReverse /socket.io/1/websocket ws://127.0.0.1:4567/socket.io/1/websocket++ ProxyPass /socket.io/ http://127.0.0.1:4567/socket.io/+ ProxyPassReverse /socket.io/ http://127.0.0.1:4567/socket.io/++ ProxyPass / http://127.0.0.1:4567/+ ProxyPassReverse / http://127.0.0.1:4567/+++The last thing you need to be sure of is that the config.json in the NodeBB folder has use_port: false. Otherwise some functionality will not work properly.++****+## Example nodebb/config.json++ {+ "base_url": "http://www.yoursite.com",+ "port": "4567",+ "use_port": false,+ "secret": "55sb254c-62e3-4e23-9407-8655147562763",+ "bind_address": "127.0.0.1",+ "database": "redis",+ "redis": {+ "host": "127.0.0.1",+ "port": "6379",+ "password": "",+ "database": "0"+ },+ "bcrypt_rounds": 12,+ "upload_path": "/public/uploads",+ "relative_path": ""+ }++>Change the domain and dont use the secret in the example above.\ No newline at end of filediff --git a/docs/configuring/proxies/nginx.rst b/docs/configuring/proxies/nginx.rstnew file mode 100644index 0000000000..5c1fbf549b--- /dev/null+++ b/docs/configuring/proxies/nginx.rst@@ -0,0 +1,50 @@+NodeBB by default runs on port `4567`, meaning that builds are usually accessed using a port number in addition to their hostname:++ http://example.org:4567++In order to allow NodeBB to be served without a port, nginx can be set up to proxy all requests to a particular hostname (or subdomain) to an upstream NodeBB build running on any port.++## Requirements++* NGINX version v1.3.13 or greater+ * Package managers may not provide a new enough version. To get the latest version, [compile it yourself](http://nginx.org/en/download.html), or if on Ubuntu, use the [NGINX Stable](https://launchpad.net/~nginx/+archive/stable) or [NGINX Development](https://launchpad.net/~nginx/+archive/development) PPA builds, if you are on Debian, use [DotDeb repository](http://www.dotdeb.org/instructions/) to get the latest version of Nginx.+ * To determine your nginx version, execute `nginx -V` in a shell++## Configuration++NGINX-served sites are contained in a `server` block. This block of options goes in a specific place based on how nginx was installed and configured:++* `/path/to/nginx/sites-available/*` -- files here must be aliased to `../sites-enabled`+* `/path/to/nginx/conf.d/*.conf` -- filenames must end in `.conf`+* `/path/to/nginx/httpd.conf` -- if all else fails++Below is the basic nginx configuration for a NodeBB build running on port `4567`:++``` nginx+server {+ listen 80;++ server_name forum.example.org;++ location / {+ proxy_set_header X-Real-IP $remote_addr;+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;+ 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";+ }+}+```++## Notes++* nginx must be on version 1.4.x to properly support websockets. Debian/Ubuntu use 1.2, although it will work there will be a reduction in functionality.+* The `proxy_pass` IP should be `127.0.0.1` if your NodeBB is hosted on the same physical server as your nginx server. Update the port to match your NodeBB, if necessary.+* This config sets up your nginx server to listen to requests for `forum.example.org`. It doesn't magically route the internet to it, though, so you also have to update your DNS server to send requests for `forum.example.org` to the machine with nginx on it!\ No newline at end of filediff --git a/docs/configuring/proxies/varnish.rst b/docs/configuring/proxies/varnish.rstnew file mode 100644index 0000000000..1b37712db5--- /dev/null+++ b/docs/configuring/proxies/varnish.rst@@ -0,0 +1,34 @@+To be sure Varnish will work properly with NodeBB check that your configuration ```/etc/varnish/default.vcl``` is optimized for **websockets**.++```varnish+backend nodebb {+ .host = "127.0.0.1"; # your nodebb host+ .port = "4567"; # your nodebb port+}++sub vcl_recv {++ # Pipe websocket connections directly to Node.js+ if (req.http.Upgrade ~ "(?i)websocket") {+ set req.backend = nodebb;+ return (pipe);+ }++ # NodeBB+ if (req.http.host == "forum.yourwebsite.com") { # change this to match your host+ if (req.url ~ "^/socket.io/") {+ set req.backend = nodebb;+ return (pipe); # return pass seems not working for websockets+ }+ return (pass); # don't cache+ }++}++sub vcl_pipe {+ # Need to copy the upgrade header+ if (req.http.upgrade) {+ set bereq.http.upgrade = req.http.upgrade;+ }+}+```\ No newline at end of file