简体   繁体   English

Docker:禁止您无权访问此资源

[英]Docker: Forbidden You don't have permission to access this resource

Im trying to reach http://localhost:8100 and all i get is: "Forbidden我试图到达 http://localhost:8100 而我得到的只是:“禁止

You don't have permission to access this resource.您无权访问此资源。

Apache/2.4.38 (Debian) Server at localhost Port 8100" Apache/2.4.38 (Debian) 服务器在 localhost 端口 8100"

In the src/ i have the docker file and a php folder in which i have both index.php and mysql.php files. In the src/ i have the docker file and a php folder in which i have both index.php and mysql.php files. The docker-compose.yml looks like this: docker-compose.yml 如下所示:

version: '3'

services:
  db:
    image: mysql:5.7
    environment:
      MYSQL_ROOT_PASSWORD: password
      MYSQL_DATABASE: test_db
      MYSQL_USER: devuser
      MYSQL_PASSWORD: devpass
    ports:
      - "9906:3306"
  web:
    image: php:7.4.0-apache
    container_name: php_web
    depends_on:
      - db
    volumes:
      - ./php/:/var/www/html/
    links:
      - db
    ports:
      - "8100:80"
    stdin_open: true
    tty: true

Commands on the terminal:终端上的命令:

docker-compose up -d
docker exec -ti php_web sh
docker-php-ext-install mysqli

When I try to reach localhost:8100/mysql.php it works fine but when i try to open either localhost:8100 or localhost:8100/index.php I get the error.当我尝试访问 localhost:8100/mysql.php 时,它工作正常,但是当我尝试打开 localhost:8100 或 localhost:8100/index.php 时出现错误。

Any clues on what could be causing it?关于可能导致它的任何线索? I hope Im being clear with my question.我希望我对我的问题很清楚。

Thanks in advance!提前致谢!

As per output of docker exec -ti php_web ls -la /var/www/html/ , i can see space in the name of the file:根据docker exec -ti php_web ls -la /var/www/html/的 output ,我可以在文件名中看到空格:

-rw-r--r-- 1 root root 70 Jul 11 23:06 ' index.php'
drwxr-xr-x 5 root root 160 Jul 11 22:40 . 
drwxr-xr-x 1 root root 4096 Nov 22 2019 .. 
drwxr-xr-x 4 root root 128 Jul 11 22:31 includes 
-rwxr-xr-x 1 root root 118 Jul 11 22:43 mysql.php

rename it and remove the space重命名并删除空格

mv ' index.php' index.php

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 403 Forbidden 您无权访问此资源 - 403 Forbidden You don't have permission to access this resource (403) 禁止。 您无权访问此资源 - (403) Forbidden. You don't have permission to access this resource PHPS 源文件 - 403 Forbidden 您无权访问此资源 - PHPS source file - 403 Forbidden You don't have permission to access this resource AWS Elastic Bean Stalk,错误 403 Forbidden “您无权访问此资源。” - AWS Elastic Bean Stalk, Error 403 Forbidden “You don't have permission to access this resource.” Laravel 收到 403 Forbidden 错误“您无权访问此资源。” - Laravel getting 403 Forbidden error “You don't have permission to access this resource.” 禁止您无权访问此资源。 .htaccess 未重定向请求 - Forbidden You don't have permission to access this resource. .htaccess is not redirecting requests 您无权访问此资源。 此外,遇到了 403 Forbidden 错误 - You don't have permission to access this resource. Additionally, a 403 Forbidden error was encountered WORDPRESS 403 禁止。 您无权访问此资源 - WORDPRESS 403 Forbidden. You don't have permission to access this resource 得到“禁止您无权访问此资源。 ” 对于特定路线 - getting “Forbidden You don't have permission to access this resource. ” for a particular route 运行Docker PHP-apache:禁止您无权访问此服务器上的/ - Run Docker PHP-apache: Forbidden You don't have permission to access / on this server
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM