I am trying to config an environment with multi container docker for deploying an symfony application in amazon web service.
I am configuring the environment using Dockerrun aws json v2 file and eb local run
The css files and the images are not working in the environment. They are called with assets like this.
symfony.conf
server {
server_name holdbusiness.local;
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;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT '/var/www/symfony/web';
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
}
error_log /var/log/nginx/symfony_error.log;
access_log /var/log/nginx/symfony_access.log;
}
Dockerfile for nginx
FROM ubuntu:14.04
MAINTAINER Coder
RUN apt - get update && apt - get install - y \
nginx
ADD nginx.conf /etc/nginx/
ADD symfony.conf /etc/nginx/sites - available/
RUN ln - s /etc/nginx/sites - available/symfony.conf /etc/nginx/sites - enabled/symfony
RUN rm /etc/nginx/sites - enabled/default
RUN echo "upstream php-upstream { server php:9000; }" > /etc/nginx/conf.d/upstream.conf
RUN usermod - u 1000 www - data
CMD ["nginx"]
EXPOSE 80
EXPOSE 443
Logs like this:
172.17.0.1 - 172.17.0.1 - - [19/Sep/2017:22:20:51 +0000] "GET /bootstrap3/css/bootstrap.min.css HTTP/1.1" 200 16134 "http://holdbusiness.local/index" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:50.0) Gecko/20100101 Firefox/50.0"
Already tested:
assets:install
composer:install
How to make assets work with Symfony3 in subdirectory on Nginx
Nginx 403 forbidden for all files
chmod 777
I discovered what was hapenning. It was because i was trying to use a command that there is in docker-compose.yml simillarly in amazon Dockerrun.aws.json.
docker-compose.yml volumes_from: - php
],
In aws it is not working. The solution was to take the volumes mounted in php container and mount again in nginx container