Skip to content

Commit

Permalink
Add customisable configuration for nginx
Browse files Browse the repository at this point in the history
- default working directory /srv/sylius can be configured using the WORKING_DIR environment variable.
- fastcgi_pass may be configured by the environment variable FASTCGI_PASS
  • Loading branch information
piotrkardasz committed Feb 2, 2024
1 parent c1e8f43 commit 9122df2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/workflows/sylius-nginx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ jobs:
- name: Docker Login
uses: docker/login-action@v3.0.0
with:
registry: ${{ secrets.DOCKER_REGISTRY }}
username: ${{ secrets.DOCKER_REPOSITORY_LOGIN }}
password: ${{ secrets.DOCKER_REPOSITORY_PASSWORD }}
logout: true
Expand Down
13 changes: 11 additions & 2 deletions nginx/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
ARG WORKING_DIR=/srv/sylius

FROM nginx:stable-alpine

RUN mkdir -p /srv/sylius
ARG WORKING_DIR

ENV WORKING_DIR=${WORKING_DIR}
ENV FASTCGI_PASS=php:9000

RUN mkdir -p ${WORKING_DIR}

COPY templates/default.conf.template /etc/nginx/templates/

COPY conf.d/default.conf /etc/nginx/conf.d/
WORKDIR ${WORKING_DIR}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
server {
root /srv/sylius/public;
root ${WORKING_DIR}/public;

location / {
# try to serve file directly, fallback to index.php
try_files $uri /index.php$is_args$args;
}

location ~ ^/index\.php(/|$) {
fastcgi_pass php:9000;
fastcgi_pass ${FASTCGI_PASS};
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;

Expand Down

0 comments on commit 9122df2

Please sign in to comment.