我正在尝试使用Apache在我的服务器上本地运行的Cloud9实例设置反向代理。 我有以下设置:
<VirtualHost *:80> ProxyPreserveHost On ProxyPass / http://localhost:3131/ ProxyPassReverse / http://localhost:3131/ ServerAdmin [email protected] ServerName cloud9.mydomain.org </VirtualHost>
我也尝试重新sorting的指令,所以ServerAdmin和ServerName第一。 到目前为止,如果我点击http://cloud9.mydomain.org ,我得到一个浏览器错误,说它无法连接。 Apache的access.log或error.log中也没有logging。 我在想,我错过了一些作品,但是我不确定这个作品可能是什么。 我也不知道我是否在正确的地方寻找原木。 Cloud9进程已启动,似乎在3131端口上运行。
我不打算开放Cloud9。 我所拍摄的最终游戏是最终通过SSL使用一些authentication(也许是基本authentication)来获取Cloud9,但是在开始添加SSL和authentication之前,我想到了,我应该先让基础知识工作。
更新 apachectl -S输出:
# apachectl -S VirtualHost configuration: wildcard NameVirtualHosts and _default_ servers: *:80 is a NameVirtualHost default server www.mydomain.org (/etc/apache2/sites-enabled/000-default:1) port 80 namevhost www.mydomain.org (/etc/apache2/sites-enabled/000-default:1) port 80 namevhost wp.mydomain.org (/etc/apache2/sites-enabled/001-wordpress:1) port 80 namevhost blog.mydomain.org (/etc/apache2/sites-enabled/001-wordpress:22) port 80 namevhost cloud9.mydomain.org (/etc/apache2/sites-enabled/003-cloud9:1) Syntax OK
curl -I cloud9.mydomain.org输出curl -I cloud9.mydomain.org :
curl: (6) Couldn't resolve host 'cloud9.mydomain.org'
curl -I localhost:3131输出curl -I localhost:3131 :
HTTP/1.1 403 Forbidden Content-Type: text/plain Content-Length: 9 Set-Cookie: cloud9.sid.3131=bqk4zxV4ETq9rrO79E4mkJn9.YW7gMDRCsOO95utQJy1mYm8LfTfZC%2F7Fx59DeFRFDpU; path=/; expires=Thu, 19 Sep 2013 02:07:41 GMT; httpOnly Date: Wed, 18 Sep 2013 22
当我尝试使用Chrome浏览器从外部访问该网站时,我得到:
哎呀! Google Chrome无法findcloud9.mydomain.org
你的意思是:mydomain.org
这是Chrome无法连接时显示的默认页面。 再次,我没有看到access.log或error.log中的任何错误,除非由于某种原因,它不logging在同一个地方。 我将进入/var/log/apache2并执行ls -lart以确保我正在看到最新的日志文件。
<VirtualHost *.80> – 将其更改为<VirtualHost *:80> 。
这可能是所有需要的,但如果不是,你可以提供apachectl -S的输出吗?
不是很漂亮,但是这适用于HTTP和SSL wo /更改为Cloud9。
必需的Apache模块: mod_proxy_wstunnel (在Apache 2.4中可用,我认为,可以为Apache 2.2.x构build教程,例如http://www.amoss.me.uk/2013/06/apache-2-2-websocket- proxying-ubuntu-mod_proxy_wstunnel / )。
ProxyPreserveHost On RewriteEngine On RewriteCond %{QUERY_STRING} transport=polling RewriteRule ^(.*)smith.io(.*) /polling [P] <Location /> ProxyPass http://localhost:3131/ ProxyPassReverse http://localhost:3131/ </Location> <Location /smith.io> ProxyPass ws://localhost:3131/smith.io ProxyPassReverse ws://localhost:3131/smith.io </Location> <Location /polling> ProxyPass http://localhost:3131/smith.io/server ProxyPassReverse http://localhost:3131/smith.io/server </Location>