Subdomain proxy for Apache
-
I'm attempting to redirect the NodeBB install to a subdomain using Apache. I have created a virtualhosts.conf file in /etc/apache2/sites-available with the configuration below:
ProxyRequests off
ServerName forum.fatalfleet.com
ServerAlias forum.fatalfleet.com<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass /socket.io/1/websocket ws://104.236.23.78:4567/socket.io/1/websocket
ProxyPassReverse /socket.io/1/websocket ws://104.236.23.78:4567/socket.io/1/websocketProxyPass /socket/io/ http://104.236.23.78:4567/socket.io/
ProxyPassReverse /socket.io/ http://104.236.23.78:4567/socket.io/ProxyPass / http://104.236.23.78:4567/
ProxyPassReverse / http://104.236.23.78:4567/What am I doing wrong here?
-
I instead added a VirtualHost entry in default.conf rather than virtualhosts.conf and it worked.
-
Scratch that, now i'm getting 502 Proxy Error whenever I try to access the site.
The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request GET /.Reason: Error reading from remote server
any intuitions?
-
Did you try it with localhost like the docs say? I'm assuming you don't have to symlink it to sites-enabled like with nginx?
Also, as you're on 2.2.22 of Debian, did you do this? Looks fun...
http://www.amoss.me.uk/2013/06/apache-2-2-websocket-proxying-ubuntu-mod_proxy_wstunnel/
-
@a_5mith said:
Did you try it with localhost like the docs say? I'm assuming you don't have to symlink it to sites-enabled like with nginx?
Also, as you're on 2.2.22 of Debian, did you do this? Looks fun...
http://www.amoss.me.uk/2013/06/apache-2-2-websocket-proxying-ubuntu-mod_proxy_wstunnel/
^
This works for Ubuntu 12.04 as well, it took awhile but I got it to work.<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/
I keep it at
127.0.0.1
because nodebb is on the same server as everything else on it. Try leaving it at127.0.0.1
and see where that gets you. -
Now, I had fixed it, and it was working, but now I have returned to getting the 502 Proxy Error. What could be causing this?
-
Ubuntu 16.04 config, if someone might come up with that problem
<VirtualHost *:80>
ServerName forum.mysite.com
<Location />
ProxyPass http://127.0.0.1:4567/
ProxyPassReverse http://1277.0.0.1:4567/
</Location>
<Location /assets>
ProxyPass http://127.0.0.1:4567/assets/
ProxyPassReverse http://1277.0.0.1:4567/assets/
</Location>
<Location /socket.io>
ProxyPass http://127.0.0.1:4567/socket.io/
ProxyPassReverse http://1277.0.0.1:4567/socket.io/
</Location>
</VirtualHost>