/文件上的Apache文件索引,反向代理打开/

我有一个在端口7000上运行的Python / CherryPy程序。它处理它自己的networking服务器,所以我使用了一个Apache反向代理,以便我可以通过mydomain.org访问它。 这工作; configuration如下。

我也希望Apache通过访问mydomain.org/files来为(与索引)目录/媒体中的任何文件提供服务。 其目的是将USB驱动器插入服务器,它会自动挂载在/ media / usb上,我可以给某个人链接。

<Location /> AuthType Basic AuthName "Secure" AuthBasicProvider file AuthUserFile /etc/apache2/auth Require valid-user Allow from 192.168.1.1/24 Satisfy Any ProxyPass http://localhost:7000/ ProxyPassReverse http://localhost:7000/ </Location> 

我是Apache的新手,所以很容易被混淆,或者没有提供足够的信息,或者没有find合适的search条件。 如果是这样,请让我知道。

确保目录/media具有正确的configuration(您需要加载mod_autoindex模块)

 <Directory /media> Allow from all Options +Indexes </Directory> 

将别名设置为指向/media

 Alias /files /media 

确保不要通过使用!代理/files URL空间! 在指令中

 ProxyPass /files ! 

特定虚拟主机的完整configuration可以如下

 <Directory /media> Allow from all Options +Indexes </Directory> Alias /files /media <Location /> AuthType Basic AuthName "Secure" AuthBasicProvider file AuthUserFile /etc/apache2/auth Require valid-user Allow from 192.168.1.1/24 Satisfy Any </Location> ProxyPass /files ! ProxyPass / http://localhost:7000/ ProxyPassReverse / http://localhost:7000/