代理Apache页面到应用程序

我有一个应用程序运行localhost:2000而我的网站是在本地主机上。 我想指出目录/projects/projectName – > localhost:2000 。 但是,当应用程序发出/发送请求时会出现问题。

例如,如果在/run时发出GET请求,则请求将GET URL显示为https://localhost/run并返回一个404.这里的两个问题是:

  1. 它redirect到端口443; 和
  2. 港口2000现在应要求丢失。

更新:我试图closuresSSL,但端口2000仍然在请求丢失。 理想情况下,我希望这与SSL的工作。

这两个问题可能是一回事,但我不确定。

要看看它应该如何工作, http://stevenshi.me:2000是工作的应用程序。 正如你所看到的,GET和POST请求转到上面的url + /foo

这是我目前的Apacheconfiguration文件

 <VirtualHost *:80> RewriteEngine on RewriteCond %{SERVER_PORT} !^443$ RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R=301,L] ServerAdmin [email protected] ServerName stevenshi.me ServerAlias www.stevenshi.me DocumentRoot /var/www/html ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> <IfModule mod_ssl.c> <VirtualHost *:443> ServerAdmin [email protected] ServerName stevenshi.me:443 ServerAlias www.stevenshi.me DocumentRoot /var/www/html SSLEngine on SSLProtocol all -SSLv2 SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM SSLCertificateFile /etc/apache2/ssl/ssl.crt SSLCertificateKeyFile /etc/apache2/ssl/private.key SSLCertificateChainFile /etc/apache2/ssl/sub.class1.server.ca.pem ProxyRequests on ProxyPreserveHost on <Proxy *> Order deny,allow Allow from localhost </Proxy> RewriteEngine on RewriteRule ^/projects/CS32Brewer/(.*)$ http://localhost:2000/$1 [ #ProxyPass /projects/CS32Brewer/ http://localhost:2000/ ProxyPassReverse /projects/CS32Brewer/ http://localhost:2000/ #ProxyPass /projects/Maps http://locahost:2001 #ProxyPassReverse /projects/Maps http://localhost:2001 ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> </IfModule> 

你将不得不重写使用mod_rewrite,或configuration应用程序来创build适当的url。