This is my first time developing a docker application form scratch. I want to have all my services running from container while I edit the code from my local machine.
So I have a root folder just called test/ and i want to follow this tutorial https://auth0.com/blog/developing-restful-apis-with-lumen/. So i need composer, a web sever (nginx), and a database (mysql).
I have inside the root folder a docker-compose file as follows:
version: '2'
services:
composer:
image: composer
container_name: composer
volumes:
- ./authors:/app
restart: always
tty: true
command: bash
php:
image: php:fpm
container_name: php
restart: always
tty: true
working_dir: /var/www
volumes:
- ./authors:/var/www
environment:
- "DB_PORT=3306"
- "DB_HOST=mysql"
nginx:
image: nginx
container_name: nginx
restart: always
tty: true
working_dir: /var/www
volumes_from:
- php
volumes:
- ./vhost.conf:/etc/nginx/conf.d/default.conf
ports:
- 8080:80
mysql:
image: mysql:5.7
container_name: mysql
restart: always
tty: true
ports:
- "3306:3306"
environment:
MYSQL_DATABASE: hmh
MYSQL_USER: root
MYSQL_ROOT_PASSWORD: root
volumes:
- dbdata:/var/lib/mysql
#Volumes
volumes:
dbdata:
And here is the configuration file used for nginx:
server {
listen 80;
index index.php index.html;
root /var/www/public;
location / {
try_files $uri /index.php?$args;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php:8000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}
The composer container is there so that I can jump into anytime I need and run some commands, while also being able to lift the project from it by running php -S localhost:8000 -t public this actually logs into the console that the server is running BUT when I go into localhost:8080 it is only showing the nginx welcome screen.
So I know nginx is working, composer lets me do all the work I need, but how do I route the php server through nginx? I can go inside the container of php, and start the server but when go to the URL it does not work. If it is not much to ask, I would like some explanation and not just the solution. Thanks.
Since I couldn't configure nginx the way I want it, I use instead Apache2 server. Here is my compose file.
version: '3'
services:
composer:
build:
context: .
dockerfile: .docker/composer.dockerfile
container_name: composer-php
user: "${UID}:${GID}"
volumes:
- .:/app
restart: always
tty: true
working_dir: /app
command: bash
environment:
DB_CONNECTION: mysql
DB_HOST: db
DB_DATABASE: lumen
DB_USERNAME: lumen
DB_PASSWORD: lumen
php:
build:
context: .
dockerfile: .docker/php.dockerfile
container_name: apache-php
user: "${UID}:${GID}"
depends_on:
- db
ports:
- 8080:8080
volumes:
- .:/app
restart: always
tty: true
working_dir: /app
command: bash
environment:
DB_CONNECTION: mysql
DB_HOST: db
DB_DATABASE: lumen
DB_USERNAME: lumen
DB_PASSWORD: lumen
db:
image: mysql:5
container_name: mysql-php
restart: always
tty: true
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: lumen
MYSQL_USER: lumen
MYSQL_PASSWORD: lumen
ports:
- "3306:3306"
volumes:
- dbdata:/var/lib/mysql
volumes:
dbdata:
With this setup, I was able to follow this tutorial https://auth0.com/blog/developing-restful-apis-with-lumen/ with no problems to test my setup. I modify the official images just to instal pdo pdo_mysql, that is all that goes inside my dockerfiles for this setup.
With that in place, I can go inside the composer container, create the project, then get out of that container and move into the php container, cd into the project, then serve the porject.
The problem here is that your server runs on port 8000 but your docker only supports port 80 via
ports:
- 8080:80
so does nginx:
listen 80;
Related
I'm trying to run a website server on a raspberry pi and I'm running into the following error in the log for nginx:
[error] 20#20: *1 connect() failed (111: Connection refused) while connecting to upstream, client: , server: , request: "GET /favicon.ico HTTP/1.1", upstream: "http://172.24.0.2:80/favicon.ico", host: "mywebsite.com", referrer: "https://mywebsite.com/"
172.24.0.2 is the internal IP address of db container.
My config file looks like:
server{
listen 443 ssl;
server_name mywebsite.com;
location / {
proxy_pass http://wordpress:80/;
proxy_set_header Host $http_host;
}
ssl_certificate /etc/letsencrypt/live/wolfsciences.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/wolfsciences.com/privkey.pem;
}
And the yaml file is:
version: "3.7"
services:
db:
build: ./db
container_name: db
ports:
- "3306:3306"
volumes:
- db_data:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: password
networks:
website_network:
aliases:
- wordpress
wordpress:
build: .
container_name: wordpress
ports:
- "80"
networks:
website_network:
aliases:
- wordpress
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: password
WORDPRESS_DB_NAME: wordpress
nginx:
build: ./nginx
container_name: nginx
ports:
- "443:443"
- "80"
networks:
website_network:
aliases:
- nginx-proxy
networks:
website_network:
name: website_network
volumes:
db_data:
driver: local
name: db_data
I'm at such a loss I don't even know where to begin.
I haven't even be able to figure out where to start. I'm knew to docker containers so I don't know how to get them to talk. I've been following a tutorial, and got the website to work for a bit, but now it just loads a blank screen.
You told nginx that the database server, which isn't listening of port 80, should be contacted when trying to reach the wordpress container:
My config file looks like:
location / {
proxy_pass http://wordpress:80/;
proxy_set_header Host $http_host;
}
And the yaml file is:
...
db:
...
networks:
website_network:
aliases:
- wordpress
To resolve this, delete all of the network aliases in the compose file, you aren't using them correctly and they are only breaking things. You can depend on the default alias of the service name (in this case db to reach the db container).
The resulting compose file can be simplified to:
version: "3.7"
services:
db:
build: ./db
container_name: db
ports:
- "3306:3306" # this is likely not needed
volumes:
- db_data:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: password
wordpress:
build: .
container_name: wordpress
ports:
- "80" # this is only needed for debugging
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: password
WORDPRESS_DB_NAME: wordpress
nginx:
build: ./nginx
container_name: nginx
ports:
- "443:443"
- "80"
volumes:
db_data:
driver: local
name: db_data
The result is that nginx will try connecting to the wordpress container rather than your database container. Whether that connection works depends on your wordpress image listening on port 80. The upstream wordpress image does, but yours is built from a different Dockerfile.
I've got a Mezzio application that works perfectly on built-in php server using compoer serve, however, when I try it in docker environment, it gives me following error.
Fatal error: Uncaught Laminas\View\Exception\RuntimeException: Laminas\View\Renderer\PhpRenderer::render: Unable to render template "error::error"; resolver could not resolve to a file in /var/www/portal/vendor/laminas/laminas-view/src/Renderer/PhpRenderer.php:492 Stack trace: #0 /var/www/portal/vendor/mezzio/mezzio-laminasviewrenderer/src/LaminasViewRenderer.php(232): Laminas\View\Renderer\PhpRenderer->render(NULL) #1 /var/www/portal/vendor/mezzio/mezzio-laminasviewrenderer/src/LaminasViewRenderer.php(221): Mezzio\LaminasView\LaminasViewRenderer->renderModel(Object(Laminas\View\Model\ViewModel), Object(Laminas\View\Renderer\PhpRenderer), Object(Laminas\View\Model\ViewModel)) #2 /var/www/portal/vendor/mezzio/mezzio-laminasviewrenderer/src/LaminasViewRenderer.php(138): Mezzio\LaminasView\LaminasViewRenderer->renderModel(Object(Laminas\View\Model\ViewModel), Object(Laminas\View\Renderer\PhpRenderer)) #3 /var/www/portal/vendor/mezzio/mezzio/src/Response/ErrorResponseGeneratorTrait.php(61): Mezzio\LaminasView\LaminasViewRende in /var/www/portal/vendor/laminas/laminas-view/src/Renderer/PhpRenderer.php on line 492
NGINX proxy (nginx.conf)
user root;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 1024;
}
http {
upstream nginx-web {
server web:8110;
}
upstream nginx-portal {
server portal:8115;
}
upstream nginx-api {
server api:8120;
}
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
server {
listen 80;
server_name proxy;
location /web {
proxy_pass http://nginx-web;
}
location /portal {
proxy_pass http://nginx-portal;
}
location /api {
proxy_pass http://nginx-api;
}
}
}
Server Block (default.conf) portal
server {
listen 8110;
root /var/www/portal/public;
server_name proxy;
location / {
try_files $uri $uri/ /index.php$is_args$args;
index index.php;
}
location ~ ^/.+\.php(/|$) {
fastcgi_pass php:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
docker-compose.yml
version: "3.9"
services:
db:
container_name: db
image: mysql:5.7
ports:
- "3306:3306"
volumes:
- "${PROJECT_ROOT}/db:/var/lib/mysql"
- ./conf/db/my.cnf:/etc/mysql/conf.d/my.cnf:ro
env_file:
- .env
networks:
- backend
proxy:
container_name: proxy
image: nginx:mainline-alpine
volumes:
- ./conf/proxy/nginx.conf:/etc/nginx/nginx.conf:ro
ports:
- "80:80"
- "8110:8110"
# - "8115:8115"
- "8120:8120"
depends_on:
- web
- portal
- api
networks:
- backend
web:
container_name: web
image: nginx:mainline-alpine
volumes:
- "${PROJECT_ROOT}/web:/var/www/web"
- ./conf/web/default.conf:/etc/nginx/conf.d/default.conf:ro
depends_on:
- php
networks:
- backend
portal:
container_name: portal
image: nginx:mainline-alpine
volumes:
- "${PROJECT_ROOT}/portal:/var/www/portal"
- ./conf/portal/default.conf:/etc/nginx/conf.d/default.conf:ro
depends_on:
- db
- php
port:
- "8115:8115"
networks:
- backend
api:
container_name: api
image: nginx:mainline-alpine
volumes:
- "${PROJECT_ROOT}/api:/var/www/api"
- ./conf/api/default.conf:/etc/nginx/conf.d/default.conf:ro
depends_on:
- php
networks:
- backend
php:
container_name: php
image: maciejslawik/php-fpm-xdebug:latest
ports:
- "9000:9000"
volumes:
- "${PROJECT_ROOT}/web:/var/www/web"
- "${PROJECT_ROOT}/portal:/var/www/portal"
- "${PROJECT_ROOT}/api:/var/www/api"
- ./conf/php/docker-php-ext-xdebug.ini:/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini:ro
networks:
- backend
composer:
container_name: composer
image: composer:2
restart: "no"
command: install
volumes:
- "${PROJECT_ROOT}/composer:/app"
- ./composer/composer.json:/app/composer.json
networks:
- backend
phinx:
container_name: phinx
image: vegbrasil/phinx:latest
volumes:
- "${PROJECT_ROOT}/migrations/database/migrations:/app/database/migrations"
- "${PROJECT_ROOT}/migrations/database/seeds:/app/database/seeds"
- ./conf/phinx/phinx.php:/app/phinx.php:ro
env_file:
- .env
depends_on:
- db
restart: "no"
command: "status"
environment:
- TESTS_PHINX_DB_ADAPTER_MYSQL_HOST=db
networks:
- backend
schemaspy:
container_name: schemaspy
image: schemaspy/schemaspy:latest
volumes:
- "${PROJECT_ROOT}/schemaspy/output:/output"
- ./conf/schemaspy/schemaspy.properties:/schemaspy.properties:ro
restart: "no"
depends_on:
- db
networks:
- backend
networks:
backend:
Update
I've tried to xdebug the issue. What I've figured out is that .phtml template file is not being resolved by PhpRenderer.php. Also I'm accessing it with url http://web.local:8115/dashboard however, ideally, I'd like to access it as http://web.local/portal/dashboard.
Suggestions
Could it be that default.conf file is processing only .php files and not .phtml files, however, I doubt it as the issue is, there's a line $file->isReadable() isn't able to process the file whereas I've verified that the file does exist. i.e. summary.phtml.
The permission for this file is also fine.
drwxrwxrwx 1 root root 4096 Oct 31 07:57 .
drwxrwxrwx 1 root root 4096 Oct 31 07:57 ..
-rwxrwxrwx 1 root root 197 Oct 31 07:57 summary.phtml
I'm learning Docker and my goal is to set up a Laravel application running on Nginx.
I managed to get to the initial login page, but when I enter credentials and try to login it redirects to the same initial page.
My guess is that is something wrong with the Nginx default.conf file. I tried a lot of things, it must be something simple that I'm missing, it's really frustrating.
Below are some info related to my problem. If there's any other info that I should provide, please let me know.
My folder structure is organized like this:
(It doesn't show all the files inside the src folder, but that's where I cloned the Laravel application)
.
├── docker-compose.yml
├── Dockerfile
├── nginx/
│ └── default.conf
└── src/
├── app/
├── bootstrap/
├── config/
├── database/
├── public/
...
├── .env
├── composer.json
...
Here's my docker-compose.yml:
version: '3'
networks:
laravel:
services:
nginx:
image: nginx:stable-alpine
container_name: nginx
ports:
- "8088:80"
volumes:
- ./src:/var/www/html
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf
depends_on:
- php
- mysql
networks:
- laravel
mysql:
image: mysql:8.0
container_name: mysql
restart: unless-stopped
tty: true
ports:
- "4306:3306"
environment:
MYSQL_DATABASE: temp
MYSQL_USER: temp
MYSQL_PASSWORD: secret
MYSQL_ROOT_PASSWORD: secret
SERVICE_TAGS: dev
SERVICE_NAME: mysql
networks:
- laravel
php:
build:
context: .
dockerfile: Dockerfile
container_name: php
volumes:
- ./src:/var/www/html
ports:
- "9000:9000"
networks:
- laravel
composer:
image: composer:latest
container_name: composer
volumes:
- ./src:/var/www/html
working_dir: /var/www/html
depends_on:
- php
networks:
- laravel
npm:
image: node:13.7
container_name: npm
volumes:
- ./src:/var/www/html
working_dir: /var/www/html
entrypoint: ['npm']
artisan:
build:
context: .
dockerfile: Dockerfile
container_name: artisan
volumes:
- ./src:/var/www/html
depends_on:
- mysql
working_dir: /var/www/html
entrypoint: ['php', '/var/www/html/artisan']
networks:
- laravel
Here's the Dockerfile:
FROM php:7.4-fpm-alpine
WORKDIR /var/www/html
RUN docker-php-ext-install pdo pdo_mysql
And here's the default.conf file:
server {
listen 80;
index index.php index.html;
server_name localhost;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
root /var/www/html/public;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}
Thank you for your time.
I can't tell exactly what the Issue is, but from my limited view. Check the loginController.php for what the $redirectTo is set equal to. That needs to point to the page you want to go to after login. If you can provide more information that would be helpful.
The issue is: php files are downloaded instead of executing.
I know there are some other similar questions out there to this one. I read many of them but either their scenerios are different or they have no correct answers. I have spent days and tried many ways but still can't figure it out. Therefore I am asking for help. The following are the scenerio, together with the .yml .conf files.
network: nginx-proxy
nginx-proxy:
- nginx (proxy) container
- docker-gen container
- letsencrypt container
web1: (this works fine)
- mysql container
- wordpress container (from wordpress image)
web2: (this has the issue: php files downloaded instead of executing)
- mysql container
- phpfpm container
- nginx container (env: VIRTUAL_HOST, LETSENCRYPT_HOST)
As mentioned above, if I use a Wordpress image, it works successfully. No hassle at all.
However, when I try to set up one with php, nginx and mysql containers myself, those php files will be downloaded instead of executing. (html files can be executed)
create network:
docker network create nginx-proxy
nginx-proxy: docker-compose.yml
version: '3'
services:
nginx:
image: nginx:1.13.1
container_name: nginx-proxy
ports:
- "80:80"
- "443:443"
volumes:
- conf:/etc/nginx/conf.d
- vhost:/etc/nginx/vhost.d
- html:/usr/share/nginx/html
- certs:/etc/nginx/certs
- ./sites-enabled:/etc/nginx/sites-enabled
labels:
- "com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy=true"
dockergen:
image: jwilder/docker-gen:0.7.3
container_name: nginx-proxy-gen
depends_on:
- nginx
command: -notify-sighup nginx-proxy -watch -wait 5s:30s /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf
volumes:
- conf:/etc/nginx/conf.d
- vhost:/etc/nginx/vhost.d
- html:/usr/share/nginx/html
- certs:/etc/nginx/certs
- /var/run/docker.sock:/tmp/docker.sock:ro
- ./nginx.tmpl:/etc/docker-gen/templates/nginx.tmpl:ro
- ./sites-enabled:/etc/nginx/sites-enabled
letsencrypt:
image: jrcs/letsencrypt-nginx-proxy-companion
container_name: nginx-proxy-le
depends_on:
- nginx
- dockergen
environment:
NGINX_PROXY_CONTAINER: nginx-proxy
NGINX_DOCKER_GEN_CONTAINER: nginx-proxy-gen
volumes:
- conf:/etc/nginx/conf.d
- vhost:/etc/nginx/vhost.d
- html:/usr/share/nginx/html
- certs:/etc/nginx/certs
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./sites-enabled:/etc/nginx/sites-enabled
volumes:
conf:
vhost:
html:
certs:
networks:
default:
external:
name: nginx-proxy
nginx.conf
# web1.local
upstream web1.local {
## Can be connected with "nginx-proxy" network
# wordpress_web1
server 192.168.96.3:80;
}
server {
server_name web1.local;
listen 80 ;
access_log /var/log/nginx/access.log vhost;
include /etc/nginx/vhost.d/default;
location / {
proxy_pass http://web1.local;
}
}
server {
server_name web1.local;
listen 443 ssl http2 ;
access_log /var/log/nginx/access.log vhost;
return 500;
ssl_certificate /etc/nginx/certs/default.crt;
ssl_certificate_key /etc/nginx/certs/default.key;
}
# web2.local
upstream web2.local {
## Can be connected with "nginx-proxy" network
# nginx_web2
server 192.168.96.7:80;
}
server {
server_name web2.local;
listen 80 ;
access_log /var/log/nginx/access.log vhost;
location / {
proxy_pass http://web2.local;
}
}
server {
server_name web2.local;
listen 443 ssl http2 ;
access_log /var/log/nginx/access.log vhost;
return 500;
ssl_certificate /etc/nginx/certs/default.crt;
ssl_certificate_key /etc/nginx/certs/default.key;
}
sites-enabled/web2.conf
(I also tried to put this part in default.conf but it didn't work)
server {
index index.php index.html index.htm;
root /var/www/html;
location ~ \.php$ {
try_files $uri $uri/ /index.php$is_args$args;
fastcgi_pass phpfpm_web2:9000;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include fastcgi_params;
}
}
apps:
web1 (Wordpress): docker-compose.yml (This works fine)
version: "3"
services:
mysql_web1:
container_name: mysql_web1
image: mysql:5.7
restart: always
volumes:
- db_data_web1:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: db1
MYSQL_USER: user1
MYSQL_PASSWORD: password
wordpress_web1:
container_name: wordpress_web1
image: wordpress:latest
restart: always
expose:
- 80
depends_on:
- mysql_web1
environment:
VIRTUAL_HOST: web1.local
LETSENCRYPT_HOST: web1.local
LETSENCRYPT_EMAIL: foo#web1.local
WORDPRESS_DB_HOST: mysql_web1:3306
WORDPRESS_DB_USER: user1
WORDPRESS_DB_PASSWORD: password
volumes:
db_data_web1:
networks:
default:
external:
name: nginx-proxy
web2: docker-compose.yml
version: "3"
services:
mysql_web2:
container_name: mysql_web2
image: mysql:5.7
restart: always
ports:
- 3306
expose:
- 3306
volumes:
- db_data_web2:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: db2
MYSQL_USER: user2
MYSQL_PASSWORD: password
phpfpm_web2:
container_name: phpfpm_web2
image: php-fpm:latest
restart: always
ports:
- 9000
expose:
- 9000
links:
- mysql_web2
depends_on:
- mysql_web2
volumes:
- ./code:/var/www/html
nginx_web2:
container_name: nginx_web2
image: nginx:1.13.1
restart: always
ports:
- 80
expose:
- 80
links:
- phpfpm_web2
depends_on:
- phpfpm_web2
volumes:
- ./code:/usr/share/nginx/html
environment:
VIRTUAL_HOST: web2.local
VIRTUAL_PORT: 80
LETSENCRYPT_HOST: web2.local
LETSENCRYPT_EMAIL: foo#web2.local
volumes:
db_data_web2:
networks:
default:
external:
name: nginx-proxy
in php-fpm.d/www.conf, I tried the following ways, but none of them worked.
listen = 127.0.0.1:9000
listen = php_container_ipaddress:9000
listen = 9000
Many thanks in advance for your help!
I'm trying to run my symfony app with docker. I have downloaded this bundle eko/docker-symfony
I have copy my symfony project inside of my docker directory.
If I refresh with localhost, I have this error: File not found.
If I put port 81 after localhost the page of Kibana will shop up.
When I run docker ps, I have noticed that the IP of all my containers is 0.0.0.0
docker-compose.yml
version: '2'
services:
db:
image: mysql
ports:
- "3306:3306"
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: symfony
MYSQL_USER: symfony
MYSQL_PASSWORD: symfony
php:
build: ./php-fpm
expose:
- "9000"
volumes:
- ./symfony:/var/www/symfony
- ./logs/symfony:/var/www/symfony/app/logs
links:
- db
nginx:
build: ./nginx
ports:
- "80:80"
links:
- php
volumes_from:
- php
volumes:
- ./logs/nginx/:/var/log/nginx
elk:
image: willdurand/elk
ports:
- "81:80"
volumes:
- ./elk/logstash:/etc/logstash
- ./elk/logstash/patterns:/opt/logstash/patterns
volumes_from:
- php
- nginx
symfony.conf
server {
server_name symfony.dev;
root /var/www/symfony/web;
location / {
try_files $uri #rewriteapp;
}
location #rewriteapp {
rewrite ^(.*)$ /app.php/$1 last;
}
location ~ ^/(app|app_dev|config)\.php(/|$) {
fastcgi_pass php-upstream;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS off;
}
error_log /var/log/nginx/symfony_error.log;
access_log /var/log/nginx/symfony_access.log;
}
I think the problem is port 80. This probably looks on your host for a file.
You can either try to run nginx under a different port f.e. 8001
nginx:
build: ./nginx
ports:
- "8001:80"
and call
http://localhost:8001
or use a hosts name. To quote the readme of eko/docker-symfony
...and do not forget to add symfony.dev in your /etc/hosts file.
like
127.0.0.1 symfony.dev
Then you can call
http://symfony.dev