2016-12-30 275 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