我正在尝试创建对所有 IP 地址关闭的 Apache 虚拟主机,但一个 IP 地址和两个应该可公开访问的 URL 除外。
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName example.com
ServerAdmin [email protected]
DocumentRoot "/var/www/example.com/app/webroot"
<Directory "/var/www/example.com/app/webroot">
Options FollowSymLinks Includes ExecCGI
AllowOverride All
ErrorDocument 403 "https://example.com/403.php"
DirectoryIndex index.php
</Directory>
<Location "/foo/bar/">
Require all granted
</Location>
<Location "/.well-known/">
Require all granted
</Location>
<Location "/">
Require ip 1.2.3.4
</Location>
SSLProxyEngine on
ProxyPreserveHost On
ProxyRequests Off
ProxyPass /api/ https://host.docker.internal:8443/api/ connectiontimeout=5 timeout=300
ProxyPassReverse /api/ https://host.docker.internal:8443/api/
SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>
我尝试更改Location
标签的顺序,但所有请求都被重定向到ErrorDocument
指令值。
URL由located in/foo/bar/
重写(出于测试目的,我尝试删除但没有效果)。.htaccess
DocumentRoot
.htaccess
阿帕奇版本:
- 服务器版本:Apache/2.4.59(Debian)
- 服务器建成:2024-04-05T12:02:26
Apache 运行在 Docker 容器中,但它可能对问题没有任何意义。
问:配置有什么问题?