我想配置多集装箱码头工人的环境中部署在亚马逊Web服务的symfony应用程序。
我使用配置AWS Dockerrun JSON V2文件和EB本地运行环境
在CSS文件和图像不能在环境中工作。 他们被称为像这样的资产。
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为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 /月/ 2017:22:20:51 0000] “GET /bootstrap3/css/bootstrap.min.css HTTP / 1.1” 200 16134“ HTTP://holdbusiness.local /索引 “ ”的Mozilla / 5.0(X11; Ubuntu的版本; Linux x86_64的; RV:50.0)壁虎/ 20100101火狐/ 50.0“
已经测试:
资产:安装
作曲:安装
如何使资产Symfony3在子目录上工作的Nginx
Nginx的403禁止所有文件
搭配chmod 777