File tree Expand file tree Collapse file tree 5 files changed +27
-19
lines changed Expand file tree Collapse file tree 5 files changed +27
-19
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,14 @@ $ git clone git@github.com:eko/docker-symfony.git
1313
1414Next, put your Symfony application into ` symfony ` folder and do not forget to add ` symfony.dev ` in your ` /etc/hosts ` file.
1515
16+ Now, you have to build your Docker images:
17+
18+ ``` bash
19+ $ docker build -t symfony/code code
20+ $ docker build -t symfony/php-fpm php-fpm
21+ $ docker build -t symfony/nginx nginx
22+ ```
23+
1624Then, run:
1725
1826``` bash
Original file line number Diff line number Diff line change 11application :
2- image : code
2+ image : symfony/ code
33 volumes :
4- - " symfony:/var/www/symfony"
5- - " logs/symfony:/var/www/symfony/app/logs"
4+ - symfony:/var/www/symfony
5+ - logs/symfony:/var/www/symfony/app/logs
66 tty : true
77db :
88 image : mysql
99 ports :
10- - " 3306:3306"
10+ - 3306:3306
1111 environment :
1212 MYSQL_ROOT_PASSWORD : root
1313 MYSQL_DATABASE : symfony
1414 MYSQL_USER : root
1515 MYSQL_PASSWORD : root
1616php :
17- image : php-fpm
17+ image : symfony/ php-fpm
1818 expose :
19- - " 9000:9000"
19+ - 9000:9000
2020 volumes_from :
2121 - application
2222 links :
2323 - db
2424nginx :
25- image : nginx
25+ image : symfony/ nginx
2626 ports :
27- - " 80:80"
27+ - 80:80
2828 links :
2929 - php
3030 volumes_from :
3131 - application
3232 volumes :
33- - " logs/nginx/:/var/log/nginx"
34- hostname : symfony.dev
33+ - logs/nginx/:/var/log/nginx
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ RUN rm /etc/nginx/sites-enabled/default
1212
1313RUN echo "upstream php-upstream { server php:9000; }" > /etc/nginx/conf.d/upstream.conf
1414
15- WORKDIR /etc/nginx
15+ RUN usermod -u 1000 www-data
1616
1717CMD ["nginx" ]
1818
Original file line number Diff line number Diff line change @@ -2,22 +2,21 @@ server {
22 server_name symfony.dev;
33 root /var/www/symfony/web;
44
5+
56 location / {
6- # try to serve file directly, fallback to app.php
7- try_files $uri /app.php$is_args$args;
7+ try_files $uri @rewriteapp;
8+ }
9+
10+ location @rewriteapp {
11+ rewrite ^(.*)$ /app.php/$1 last;
812 }
913
10- # PROD
11- location ~ ^/app\.php(/|$) {
14+ location ~ ^/(app|app_dev|config)\.php(/|$) {
1215 fastcgi_pass php-upstream;
1316 fastcgi_split_path_info ^(.+\.php)(/.*)$;
1417 include fastcgi_params;
1518 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
1619 fastcgi_param HTTPS off;
17- # Prevents URIs that include the front controller. This will 404:
18- # http://domain.tld/app.php/some-path
19- # Remove the internal directive to allow URIs like this
20- internal;
2120 }
2221
2322 error_log /var/log/nginx/symfony_error.log;
Original file line number Diff line number Diff line change @@ -9,6 +9,8 @@ ADD symfony.ini /etc/php5/cli/conf.d/
99
1010ADD symfony.pool.conf /etc/php5/fpm/pool.d/
1111
12+ RUN usermod -u 1000 www-data
13+
1214CMD ["php5-fpm" , "-F" ]
1315
1416EXPOSE 9000
You can’t perform that action at this time.
0 commit comments