Skip to content

Commit

Permalink
Merge pull request #39 from outstack/replace-caddy-with-nginx
Browse files Browse the repository at this point in the history
Replaced caddy with nginx
  • Loading branch information
Steve Todd committed Mar 14, 2018
2 parents 2ae1975 + 187a81e commit 6d7a2ad
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 18 deletions.
14 changes: 0 additions & 14 deletions Caddyfile

This file was deleted.

8 changes: 6 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ RUN apk update --no-cache \
&& apk add ca-certificates \
&& apk add zlib-dev \
&& apk add bash \
&& apk add caddy \
&& apk add nginx \
&& apk add zip \
&& apk add unzip \
&& docker-php-source extract \
Expand All @@ -26,7 +26,11 @@ RUN infrastructure/scripts/install-composer.sh && \

COPY . /app
RUN cp /app/infrastructure/php-fpm/php-fpm.conf /usr/local/etc/php-fpm.conf && \
cp /app/infrastructure/php-fpm/www.conf /usr/local/etc/php-fpm.d/www.conf
cp /app/infrastructure/php-fpm/www.conf /usr/local/etc/php-fpm.d/www.conf && \
cp /app/infrastructure/nginx/nginx.conf /etc/nginx/conf.d/default.conf

RUN ln -sf /dev/stdout /var/log/nginx/access.log && ln -sf /dev/stderr /var/log/nginx/error.log

RUN chown -R www-data composer.phar var vendor

ENV SYMFONY_ENV prod
Expand Down
4 changes: 2 additions & 2 deletions Procfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
caddy: PYTHONUNBUFFERED=true /usr/sbin/caddy
php: /usr/local/sbin/php-fpm -F
nginx: PYTHONUNBUFFERED=true nginx -g 'pid /tmp/nginx.pid; daemon off;'
php: /usr/local/sbin/php-fpm -F
25 changes: 25 additions & 0 deletions infrastructure/nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
server {
root /app/web;
listen 80 default_server;

location / {
# try to serve file directly, fallback to app.php
try_files $uri /app.php$is_args$args;
}
# PROD
location ~ ^/app\.php(/|$) {
fastcgi_pass 127.0.0.1:9000;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
internal;
}

# return 404 for all other php files not matching the front controller
# this prevents access to other php files you don't want to be accessible.
location ~ \.php$ {
return 404;
}

}

0 comments on commit 6d7a2ad

Please sign in to comment.