我是 Docker 和 Apache 的新手,正在尝试执行一个非常简单的程序,该程序将在我的本地主机上显示一个网页。然而,我一直听到403 Forbidden error这样一句话:
“您无权访问此服务器上的/”
。我正在Apache/2.4.25 (Debian)localhost Port 使用服务器5002。该目录的路径是~/tutorial/product. 我在这里阅读了许多解决方案,并尝试了所有解决方案,但没有一个对我有用。
/etc/apache2/apache2.conf
<Directory /var/www/html>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Run Code Online (Sandbox Code Playgroud)
/etc/apache2/sites-enabled/000-default.conf
ServerAdmin webmaster@localhost
DocumentRoot /var/www/signature
<Directory /var/www/signature/>
Allowoverride all
Order allow,deny
Allow from all
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
Run Code Online (Sandbox Code Playgroud)
我已使用以下命令将路径中每个目录的权限包含在内ls -l:
〜/教程
|---------------------|------------------|
| -rwxr-xr-x |docker-compose.yml|
|---------------------|------------------|
| drwxr-xr-x | product |
|---------------------|------------------|
| drwxr-xr-x | website |
|---------------------|------------------|
Run Code Online (Sandbox Code Playgroud)
〜/教程/产品
|---------------------|------------------|
| -rwxr-xr-x | api.py |
|---------------------|------------------|
| -rwxr-xr-x | Dockerfile |
|---------------------|------------------|
| -rwxr-xr-x | index.php |
|---------------------|------------------|
| -rwxr-xr-x | requirements.txt |
|---------------------|------------------|
Run Code Online (Sandbox Code Playgroud)
您的 Docker 容器中缺少文件。您需要发出以下命令将文件从您的计算机转移到 docker 容器。
从您的容器中发出此命令。
docker cp index.php 4fdb84ef3ef4:/var/www/html/index.php
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
34146 次 |
| 最近记录: |