1
I’m working on a web system using Docker with Nginx. And I am not being able to access files that are not in the root folder of the project, if possible I would like to understand what is happening and how I can solve.
Below is the code of the Docker-Compose.yml
nginx:
image: tutum/nginx
ports:
- "80:80"
links:
- phpfpm
volumes:
- ./nginx/default:/etc/nginx/sites-available/default
- ./nginx/default:/etc/nginx/sites-enabled/default
- ./logs/nginx-error.log:/var/log/nginx/error.log
- ./logs/nginx-acess.log:/var/log/nginx/acess.log
phpfpm:
image: php:fpm
ports:
- "9000:9000"
volumes:
- ./html:/usr/share/nginx/html
mysql:
image: mariadb
environment:
- MYSQL_ROOT_PASSWORD=admin
volumes:
- ./mysql:/var/lib/mysql
phpmyadmin:
image: phpmyadmin/phpmyadmin
restart: always
links:
- mysql
ports:
- 8183:80
environment:
- MYSQL_USERNAME=admin
- MYSQL_ROOT_PASSWORD=admin
- PMA_ARBITRARY=1
Below is the default for NGINX:
server {
listen 80;
root /usr/share/nginx/html;
server_name "IP_LOCAL";
location / {
try_files $uri /index.php$is_args$args;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass phpfpm:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Image of how the project is structured with the notes
Code index.php
<head>
<meta charset ="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel= "stylesheet" href="config/css/bootstrap.min.css">
<link rel= "stylesheet" href="config/css/login.css">
</head>
<body>
<div class="login-form col-xs-10 col-xs-offset-1 col-sm-6 col-sm-offset-3 col-md-4 col-md-offset-4">
<header>
<h1><img class="img-responsive" src="img/app-mini.png"></h1>
<h2 class="text-center"> Entre com o seu <b>usuário</b> e <b>senha</b> </h2>
</header>
<form>
<div class="form-group">
<div class="input-group">
<div class="input-group-addon">
<span class="glyphicon glyphicon-user"></span>
</div>
<input type="text" name="usuário" class="form-control" placeholder="Usuário">
</div>
</div>
<div class="form-group">
<div class="input-group">
<div class="input-group-addon">
<span class="glyphicon glyphicon-option-horizontal"></span>
</div>
<input type="password" name="senha" class="form-control" placeholder="Senha">
</div>
</div>
<footer>
<div class="checkbox pull-left">
<label> <input type="checkbox" name="Lembrar">Esquecer a Senha</label>
</div>
<button type="submit" class="btn btn-primary pull-right"> Entrar</button>
</footer>
</form>
</div>
<script src= "config/js/jquery-3.2.1.min.js"></script>
<script src="config/js/bootstrap.min.js"></script>
</body>
"- I am unable to access the files." What files? Where are you "invoking them"? Post your code in text form: manual on how NOT to ask questions.
– LipESprY
Lipespry-off-, Code added.
– Jack