我可以像这样设置代理
NameVirtualHost *:80
<VirtualHost *:80>
ServerName example.ca
ProxyPreserveHost On
ProxyVia Full
#ProxyRequests off
# setup the proxy
<Proxy *>
Order allow,deny
Allow from all
</Proxy>
ProxyPass / http://10.0.0.0:123/
ProxyPassReverse / http://10.0.0.0:123/
</VirtualHost>
但不是当我包含这样的子域时
NameVirtualHost *:80
<VirtualHost *:80>
ServerName dev.example.ca
ProxyPreserveHost On
ProxyVia Full
#ProxyRequests off
# setup the proxy
<Proxy *>
Order allow,deny
Allow from all
</Proxy>
ProxyPass / http://10.0.0.0:123/
ProxyPassReverse / http://10.0.0.0:123/
ErrorLog logs/vhost-error_log
CustomLog logs/vhost-access_log common
</VirtualHost>
我已经查看了整个网络,上面的解决方案应该可以工作,但事实并非如此。任何想法有什么问题。
编辑根据JoeT 的要求,我更新了上面的代码以包含日志,如下所示(vhost_error_log 为空)
虚拟主机访问日志
xxx.xxx.xxx.xxx - - [26/Aug/2015:18:09:58 -0700] "GET / HTTP/1.1" 200 4607
xxx.xxx.xxx.xxx - - [26/Aug/2015:18:09:58 -0700] "GET /assets/application-ffeeed35892b38ff9bfa135564fb0830.css HTTP/1.1" 304 256
xxx.xxx.xxx.xxx - - [26/Aug/2015:18:09:58 -0700] "GET /assets/print-47fe51cdf70398e5e54b544e0f5cc718.css HTTP/1.1" 304 255
xxx.xxx.xxx.xxx - - [26/Aug/2015:18:09:58 -0700] "GET /assets/application-3302fd299e1a3e701974f594a4a76c56.js HTTP/1.1" 304 257
xxx.xxx.xxx.xxx - - [26/Aug/2015:18:09:58 -0700] "GET /assets/logo-ca207549507c811d027110077cf86e90.svg HTTP/1.1" 304 255
xxx.xxx.xxx.xxx - - [26/Aug/2015:18:09:58 -0700] "GET /assets/icon-search-1aee2102ac9ef7c077acce219d346074.png HTTP/1.1" 304 254
xxx.xxx.xxx.xxx - - [26/Aug/2015:18:09:58 -0700] "GET /assets/jquery-ui/ui-bg_flat_75_ffffff_40x100-d20cf782ea2d212335fa15f2ecb5e412.png HTTP/1.1" 304 254
xxx.xxx.xxx.xxx - - [26/Aug/2015:18:09:58 -0700] "GET /?limit=20&offset=0 HTTP/1.1" 200 3394
我不是通过 apache 服务器,而是通过我的域提供商修复了解决方案。
您必须登录您的帐户并创建子域,即
我以前只设置了一个本地 apache 服务器,我的文件正在捕获对and
/etc/hosts
的请求,并自动将其重定向到 192.0.0.123example.ca
john.example.ca