2015-11-05 29 views
0

我一直在嘗試在Apache 14.04上爲HTTP應用程序在Apache上實現反向SSL代理時出現問題。作爲基準,當我通過瀏覽器中的端口8000正常訪問它時,應用程序可以正常工作。對於所有意圖和目的,假設我的應用程序的IP爲192.141.56.11(我還沒有域名)。該應用程序使用HTTP Basic Auth運行,我不知道它是否相關。基本上我在這裏釣魚時會遇到一些明顯的錯誤,如果你能幫助我,我會很感激。下面是一個日誌我的過程:如何在HTTP應用程序上啓用Apache SSL反向代理

我建立了我的SSL證書和密鑰,並把它們在以下位置:

/etc/apache/ssl/apache.crt (I performed chmod 644 here) 
/etc/apache/ssl/apache.key (I performed chmod 400 here) 

然後我裝:

apt-get install apache2 
a2enmod proxy 
a2enmod ssl 
a2enmod proxy_http 

我然後禁用默認配置與:

a2dissite 000-default 

我創建了文件「/etc/apache2/sites-available/redirect.conf」

然後我創建的文件 「/etc/apache2/sites-available/redirect.conf」,並複製下面的文本:

<VirtualHost *:80> 
    Redirect "/" "https://192.141.56.11" 
</VirtualHost> 

後,我創建的文件在「/ etc/apache2的/ sites-可用/ reverse_proxy.conf」及以下複製:

<VirtualHost *:443> 
SSLEngine On 
SSLCertificateFile /etc/apache/ssl/apache.crt 
SSLCertificateKeyFile /etc/apache/ssl/apache.key 
ProxyPass/http://127.0.0.1:8000/ 
ProxyPassReverse/http://127.0.0.1:8000/ 

,做:

service apache2 restart 

我現在試圖訪問Chrome瀏覽器中另一臺計算機上應用程序的UI。嘗試時:

https://192.141.56.11 

我得到一個通用的SSL連接錯誤。

然而,試圖

http://192.141.56.11:8000 

給我的應用程序,因爲如果沒有我的配置的改變任何東西。然而,

192.141.56.11:80 

給了我一個 「指標」 頁面,上面寫着 「阿帕奇/ 2.4.7(Ubuntu的)服務器在192.141.56.11端口80」

192.141.56.11:443 

給了我一個html文件夾相同的結果除了「Apache/2.4.7(Ubuntu)服務器在192.141.56.11端口443」

我試過所有的配置方式,但無法得到我想要的 - 這裏的任何想法?

回答

0

編輯:我試過https [:] // 192.141.56。11,並得到了更具體的SSL錯誤:

received a record that exceeded the maximum permissible length. (Error code: ssl_error_rx_record_too_long) 

編輯2:運行apache後,我得到這個警告;

apache2: Could not reliably determine the server's fully qualified domain  name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message 

我想這很好,因爲我使用的是IP而不是域名。

EDIT3:事實證明,我需要做的:

a2ensite reverse_proxy.conf. 

現在HTTPS [:] // 192.141.56.11的作品,但默認爲apache的頁面。在此工作。

EDIT4:我不得不這樣做 a2dissite默認的ssl.conf

現在它實際上重定向到應用程序的HTTPS [:] // 192.141.56.11!但我仍然可以通過端口8000訪問應用程序,這是壞的{仍在工作中}

EDIT5:最後,我想不出如何通過Apache上的端口8000來阻止對原始應用程序的訪問。相反,我只在服務器上實現了iptables,因此只能通過HTTPS訪問它。這可能不是正確的方法。但我只能想到。

相關問題