我是Docker和Apache的新手,我正在尝试执行一个非常简单的程序,它会在我的localhost上显示一个网页。但是,我继续得到一个403 Forbidden error
说
“您无权访问/在此服务器上”
。我在localhost端口Apache/2.4.25 (Debian)
使用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>
/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
我已使用ls -l
在路径中的每个目录中包含权限:
〜/教程
|---------------------|------------------|
| -rwxr-xr-x |docker-compose.yml|
|---------------------|------------------|
| drwxr-xr-x | product |
|---------------------|------------------|
| drwxr-xr-x | website |
|---------------------|------------------|
〜/教程/产品
|---------------------|------------------|
| -rwxr-xr-x | api.py |
|---------------------|------------------|
| -rwxr-xr-x | Dockerfile |
|---------------------|------------------|
| -rwxr-xr-x | index.php |
|---------------------|------------------|
| -rwxr-xr-x | requirements.txt |
|---------------------|------------------|
您丢失了Docker Container中的文件。您需要发出以下命令,将您的文件从您的机器带到docker容器。
从容器中发出此命令。
docker cp index.php 4fdb84ef3ef4:/var/www/html/index.php