Apache反向代理未按预期方式重写URL

o3imoua4  于 2022-11-16  发布在  Apache
关注(0)|答案(2)|浏览(163)

我是一个很新的Apache,并希望设置一个反向代理,以便能够访问一些IP摄像机的网页界面,我从一个网站.我使用的基本布局如下:

/ Cam 1 - 192.168.1.10  
Reverse Proxy - 192.168.1.6 -
                             \ Cam 2 - 192.168.1.11

当我单击链接时,它无法正确解析,URL应该是http://192.168.1.6/cam1/settings.htm,但它解析为http://192.168.1.6/setting.htm

Not Found
The requested URL /setting.htm was not found on this server.
Apache/2.2.22 (Debian) Server at 192.168.1.6 Port 80

我的Config在这里,我使用的是标准的httpd.conf,并启用了代理和重写模块:

ProxyRequests off
<Proxy *>
    Order allow,deny
    Allow from all
</Proxy>

<VirtualHost *>
        Servername webserver
        RewriteEngine on

        RewriteRule ^/cam1/(.*)$ http://192.168.1.10$1 [P]
        RewriteRule ^/cam2/(.*)$ http://192.168.1.11$1 [P]

        ProxyPass /cam1 http://192.168.1.10
        ProxyPassReverse /cam1 http://192.168.1.10
        ProxyPass /cam2 http://192.168.1.11
        ProxyPassReverse /cam2 http://192.168.1.11

</VirtualHost>

任何帮助都将不胜感激。
干杯亚当

qfe3c7zg

qfe3c7zg1#

在日志中,您可以清楚地看到有一些文件丢失,如文件不存在:/var/www/jpg和**/var/www/lang**所以这可能是你的存储问题的原因。我敢打赌,你错过了一些配置,而服务器或你的服务器msy损坏这些文件,而运行由于一些其他文件。我建议你重新下载,然后重新安装它。

ef1yzkbh

ef1yzkbh2#

对于将来的用户:
cat /etc/apache 2/可用站点/默认

<VirtualHost *:80>
    ServerAdmin user@work.com.br

    DocumentRoot /var/www
    <Directory />
            Options FollowSymLinks
            AllowOverride All
    </Directory>
    <Directory /var/www/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
            AllowOverride None
            Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
            Order allow,deny
            Allow from 192.168.5.25
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access.log combined

    ProxyPass               /cameras/               http://192.168.5.6/
    ProxyPassReverse        /cameras/               http://192.168.5.6/

相关问题