2016-12-30 237 views
0

我有一個Apache服務器和傳輸守護進程一起運行。 只有80和443端口是開放的,我希望能夠從「https://address.net/transmission」接入到傳輸的網絡界面,而不是「本地主機:9091」Apache反向代理問題

我跟幾個導遊,但我不能讓它工作(ERR_CONNECTION_REFUSED或502),這是我最後的配置。謝謝。

apache2.conf:

Mutex file:${APACHE_LOCK_DIR} default 
PidFile ${APACHE_PID_FILE} 
Timeout 300 
KeepAlive On 
MaxKeepAliveRequests 100 
KeepAliveTimeout 5 
User ${APACHE_RUN_USER} 
Group ${APACHE_RUN_GROUP} 
HostnameLookups Off 
ErrorLog ${APACHE_LOG_DIR}/error.log 
LogLevel warn 

IncludeOptional mods-enabled/*.load 
IncludeOptional mods-enabled/*.conf 

Include ports.conf 

<Directory /path/apache> 
    Options Indexes FollowSymLinks 
    AllowOverride None 
    Require all granted 
</Directory> 


<Directory /path/apache/private> 
     AuthType Basic 
     AuthName "Restricted Content" 
     AuthUserFile /path/.htpasswd 
     Require valid-user 
</Directory> 

AccessFileName .htaccess 
<FilesMatch "^\.ht"> 
    Require all denied 
</FilesMatch> 

IncludeOptional conf-enabled/*.conf 
IncludeOptional sites-enabled/*.conf 

ports.conf:

Listen 80 
Listen 443 

proxy.conf:

<IfModule mod_proxy.c> 
    ProxyRequests Off 
    ProxyPreserveHost On 
    <Proxy *> 
     AddDefaultCharset off 
     Order deny,allow 
      Allow from all 
    </Proxy> 

     ProxyPass /transmission https://localhost:9091 
     ProxyPassReverse /transmission https://localhost:9091 

    ProxyVia On 

</IfModule> 

/sites-enabled/000-default.conf:

<VirtualHost *:80> 
    ServerName address.net 

    DocumentRoot /path/apache 

    ErrorLog ${APACHE_LOG_DIR}/error.log 
    CustomLog ${APACHE_LOG_DIR}/access.log combined 


     Redirect permanent/https://address.net/ 

</VirtualHost> 

/sites-enabled/default-ssl.conf:

<IfModule mod_ssl.c> 
    <VirtualHost _default_:443> 

     ServerName address.net 
     DocumentRoot /path/apache 


     ErrorLog ${APACHE_LOG_DIR}/error.log 
     CustomLog ${APACHE_LOG_DIR}/access.log combined 


     SSLEngine on 

     SSLCertificateFile /stuff.pem 
     SSLCertificateKeyFile /morestuff.pem 


     SSLProxyEngine on 

     <FilesMatch "\.(cgi|shtml|phtml|php)$"> 
       SSLOptions +StdEnvVars 
     </FilesMatch> 
     <Directory /usr/lib/cgi-bin> 
       SSLOptions +StdEnvVars 
     </Directory> 

     BrowserMatch "MSIE [2-6]" \ 
       nokeepalive ssl-unclean-shutdown \ 
       downgrade-1.0 force-response-1.0 
     BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown 

    </VirtualHost> 
</IfModule> 

回答

0

也許

ProxyPass /transmission https://localhost:9091 
    ProxyPassReverse /transmission https://localhost:9091 

應該是:

ProxyPass /transmission http://localhost:9091 
    ProxyPassReverse /transmission http://localhost:9091 
+0

嗯它去「address.net重定向你太多次。 「我認爲這是因爲在0000-default.conf – marvin

+0

nope中的重定向,即80端口,所以不會影響'https://'。嘗試添加尾部斜線:'ProxyPass/transmission/http:// localhost:9091 /' –

+0

「address.net重定向了太多次。」還有尾隨斜線。 – marvin