Apache Docker容器中使用了错误的DocumentRoot
即使我在配置中指定了Apache Docker容器中使用了错误的DocumentRoot,apache,docker,Apache,Docker,即使我在配置中指定了DocumentRoot,我也需要指定DocumentRoot中包含的子文件夹来加载URL 作品:192.168.2.35/default/index.html 不起作用,但需要:192.168.2.35/index.html docker exec-it apache httpd-S的输出,显示加载的虚拟主机: me@server:/var/www/html$ docker exec -it apache httpd -S AH00558: httpd: Could n
DocumentRoot
,我也需要指定DocumentRoot
中包含的子文件夹来加载URL
- 作品:192.168.2.35/default/index.html
- 不起作用,但需要:192.168.2.35/index.html
docker exec-it apache httpd-S的输出,显示加载的虚拟主机:
me@server:/var/www/html$ docker exec -it apache httpd -S
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
VirtualHost configuration:
192.168.2.35:80 localhost (/usr/local/apache2/conf/enabled-sites/default.conf:10)
ServerRoot: "/usr/local/apache2"
Main DocumentRoot: "/usr/local/apache2/htdocs"
Main ErrorLog: "/proc/self/fd/2"
Mutex default: dir="/usr/local/apache2/logs/" mechanism=default
PidFile: "/usr/local/apache2/logs/httpd.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www-data" id=33
Group: name="www-data" id=33
Docker容器的我的卷:
"Binds": [
"/var/www/html:/usr/local/apache2/htdocs:rw",
"/etc/apache2/conf:/usr/local/apache2/conf:ro",
"/var/log/apache2:/usr/local/apache2/logs:rw"
],
default.conf
:
<Directory /usr/local/apache2/htdocs/default>
Options -Indexes
AllowOverride All
Require all granted
</Directory>
<VirtualHost 192.168.2.35:80>
ServerName localhost
ServerAdmin webmaster@localhost
DocumentRoot /usr/local/apache2/htdocs/default
LogLevel debug
ErrorLog logs/error.default.ca.log
CustomLog logs/access.default.ca.log combined
</VirtualHost>
选项-索引
允许超越所有
要求所有授权
服务器名本地主机
服务器管理员webmaster@localhost
DocumentRoot/usr/local/apache2/htdocs/default
日志级调试
ErrorLog日志/error.default.ca.log
CustomLog日志/access.default.ca.log组合
为virtualhost指定的IP与Docker使用的IP不匹配
在virtualhost中使用*:80
可以修复它