Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use nginx official image #91

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .env.dist
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Symfony application's path (absolute or relative)
SYMFONY_APP_PATH=../path/to/symfony/folder

# Symfony application's host
NGINX_HOST=symfony.local

# MySQL
MYSQL_ROOT_PASSWORD=root
MYSQL_DATABASE=mydb
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ Docker-symfony gives you everything you need for developing Symfony application.
$ docker-compose up -d
```

3. Update your system host file (add symfony.local)
3. Update your system host file (add value you've assigned to NGINX_HOST environmental variable)

```bash
# UNIX only: get containers IP address and update host (replace IP according to your configuration) (on Windows, edit C:\Windows\System32\drivers\etc\hosts)
$ sudo echo $(docker network inspect bridge | grep Gateway | grep -o -E '[0-9\.]+') "symfony.local" >> /etc/hosts
$ sudo echo $(docker network inspect bridge | grep Gateway | grep -o -E '[0-9\.]+') "yourhostname" >> /etc/hosts
```

**Note:** For **OS X**, please take a look [here](https://docs.docker.com/docker-for-mac/networking/) and for **Windows** read [this](https://docs.docker.com/docker-for-windows/#/step-4-explore-the-application-and-run-examples) (4th step).
Expand Down
6 changes: 5 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,17 @@ services:
- ${SYMFONY_APP_PATH}:/var/www/symfony
- ./logs/symfony:/var/www/symfony/app/logs
nginx:
build: nginx
image: nginx
ports:
- 80:80
volumes_from:
- php
volumes:
- ./nginx/default.template:/etc/nginx/conf.d/default.template
- ./logs/nginx/:/var/log/nginx
environment:
- NGINX_HOST=${NGINX_HOST}
command: /bin/sh -c "envsubst '$$NGINX_HOST' < /etc/nginx/conf.d/default.template > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'"
elk:
image: willdurand/elk
ports:
Expand Down
21 changes: 0 additions & 21 deletions nginx/Dockerfile

This file was deleted.

6 changes: 4 additions & 2 deletions nginx/symfony.conf → nginx/default.template
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
server {
server_name symfony.local;
listen 80 default_server;
listen [::]:80 default_server;
server_name ${NGINX_HOST};
root /var/www/symfony/web;

location / {
Expand All @@ -11,7 +13,7 @@ server {
}

location ~ ^/(app|app_dev|config)\.php(/|$) {
fastcgi_pass php-upstream;
fastcgi_pass php:9000;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
Expand Down
29 changes: 0 additions & 29 deletions nginx/nginx.conf

This file was deleted.