我们已经build立了一个Apache反向代理服务器,用于在SSH隧道末端从ovpn客户端提供网页。 我们在核心(服务器版本:Apache / 2.4.18(Ubuntu))和运行debian(服务器版本:Apache / 2.2.22(Debian))的硬件vpnterminal设备上安装Ubuntu VM。 我们使用的子域名的url和最初的代理工作得很好。 我们使用基于名字的虚拟主机,第一级的站点可用configuration文件如下所示。
<VirtualHost *:80> ServerAdmin [email protected] ProxyRequests on DocumentRoot /var/www ProxyPreserveHost On ServerName subdomain.domain.co.uk ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel error <Location /> ProxyPass "http://10.8.0.10/" ProxyPassReverse "http://10.8.0.10/" Order allow,deny Allow from all </Location> </VirtualHost>
所以现在我们试图访问隧道端接主机后面的设备的Web界面。 反向代理反向代理
我们已经设想得到这个工作,但它不工作。
我们在核心服务器上设置了一个站点可用的configuration文件,如下所示。
<VirtualHost *:80> ServerAdmin [email protected] ProxyRequests on DocumentRoot /var/www ProxyPreserveHost On ServerName subdomain.subdomain.domain.co.uk ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel error <Location /> ProxyPass "http://subdomain.domain.co.uk/" ProxyPassReverse "http://subdomain.domain.co.uk/" Order allow,deny Allow from all </Location> </VirtualHost>
最后,我们使用VPN终止主机上的以下站点。
<VirtualHost *:80> ServerAdmin [email protected] DocumentRoot /var/www ProxyPreserveHost On ProxyHTMLStripComments on ProxyRequests off SetOutputFilter proxy-html ProxyHTMLDoctype XHTML ServerName subdomain.subdomain.domain.co.uk ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel error <Location /> ProxyPass "http://192.168.0.2/" ProxyPassReverse "http://192.168.0.2/" Order allow,deny Allow from all </Location> </VirtualHost>
核心服务器上加载的模块如下
sudo apachectl -M [sudo] password for paula: [Wed Aug 23 19:23:10.434969 2017] [alias:warn] [pid 27397] AH00671: The ScriptAlias directive in /etc/apache2/conf-enabled/smokeping.conf at line 1 will probably never match because it overlaps an earlier ScriptAlias. [Wed Aug 23 19:23:10.435691 2017] [alias:warn] [pid 27397] AH00671: The Alias directive in /etc/apache2/conf-enabled/smokeping.conf at line 2 will probably never match because it overlaps an earlier Alias. Loaded Modules: core_module (static) so_module (static) watchdog_module (static) http_module (static) log_config_module (static) logio_module (static) version_module (static) unixd_module (static) access_compat_module (shared) alias_module (shared) auth_basic_module (shared) authn_core_module (shared) authn_file_module (shared) authz_core_module (shared) authz_host_module (shared) authz_user_module (shared) autoindex_module (shared) cgi_module (shared) deflate_module (shared) dir_module (shared) env_module (shared) filter_module (shared) headers_module (shared) mime_module (shared) mpm_prefork_module (shared) negotiation_module (shared) php7_module (shared) proxy_module (shared) proxy_ajp_module (shared) proxy_balancer_module (shared) proxy_connect_module (shared) proxy_html_module (shared) proxy_http_module (shared) rewrite_module (shared) setenvif_module (shared) slotmem_shm_module (shared) status_module (shared) xml2enc_module (shared)
在VPN终结符上,如下所示
sudo apachectl -M apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName Loaded Modules: core_module (static) log_config_module (static) logio_module (static) version_module (static) mpm_prefork_module (static) http_module (static) so_module (static) alias_module (shared) auth_basic_module (shared) authn_file_module (shared) authz_default_module (shared) authz_groupfile_module (shared) authz_host_module (shared) authz_user_module (shared) autoindex_module (shared) cgi_module (shared) deflate_module (shared) dir_module (shared) env_module (shared) fcgid_module (shared) mime_module (shared) negotiation_module (shared) php5_module (shared) proxy_module (shared) proxy_connect_module (shared) proxy_html_module (shared) proxy_http_module (shared) reqtimeout_module (shared) rewrite_module (shared) setenvif_module (shared) status_module (shared) Syntax OK
我正在寻找关于如何可靠地使这项工作的指针。 如果有任何相关的细节,我忘了包括只是大声疾呼在这里添加它。
感谢您阅读这一点。