没有获得资产symfony eb本地运行 [英] does not get asset symfony eb local run
问题描述
我正在尝试使用多容器docker配置一个环境,以在Amazon Web Service中部署symfony应用程序.
I am trying to config an environment with multi container docker for deploying an symfony application in amazon web service.
我正在使用Dockerrun aws json v2文件和eb local run配置环境
I am configuring the environment using Dockerrun aws json v2 file and eb local run
css文件和图像在环境中不起作用. 他们被称为这样的资产.
The css files and the images are not working in the environment. They are called with assets like this.
symfony.conf
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;
}
nginx的Dockerfile
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
这样的日志:
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"
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"
已经过测试:
资产:安装
composer:install
composer:install
chmod 777
chmod 777
推荐答案
我发现了正在发生的事情.这是因为我试图使用亚马逊Dockerrun.aws.json中类似docker-compose.yml中的命令.
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 volume_from: -PHP
docker-compose.yml volumes_from: - php
DockerRun.aws.json
"volumesFrom": [
{
"sourceContainer": "php"
}
],
在aws中,它不起作用.解决方案是将卷装入php容器中,然后再次装入nginx容器
In aws it is not working. The solution was to take the volumes mounted in php container and mount again in nginx container
"mountPoints": [
{
"sourceVolume": "volumeSymfony",
"containerPath": "/var/www/appSymfony"
}
]
这篇关于没有获得资产symfony eb本地运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!