-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Update Dockerfile-nginx and Dockerfile-php for improved config…
…uration
- Loading branch information
1 parent
0c2dfea
commit 4fdcb45
Showing
3 changed files
with
29 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,16 @@ | ||
FROM nginx | ||
FROM nginx:latest | ||
|
||
# Install necessary utilities to use usermod | ||
RUN apt-get update && apt-get install -y passwd | ||
|
||
# Copy your custom Nginx configuration | ||
COPY ./docker/build/default.conf /etc/nginx/conf.d/ | ||
|
||
# Create the upstream config | ||
RUN echo "upstream php-upstream { server fpm:9000; }" > /etc/nginx/conf.d/upstream.conf | ||
|
||
# Change the user ID for the www-data user (optional) | ||
RUN usermod -u 1000 www-data | ||
|
||
# Expose the port the container will listen on | ||
EXPOSE 80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,26 @@ | ||
server { | ||
listen 80; | ||
server_name localhost; | ||
root /var/www/demo/public; | ||
|
||
location / { | ||
try_files $uri @rewriteapp; | ||
} | ||
server_name localhost; | ||
|
||
root /var/www/demo/public; # Make sure this is where your app files are | ||
|
||
location @rewriteapp { | ||
rewrite ^(.*)$ /index.php/$1 last; | ||
index index.php index.html index.htm; | ||
|
||
# Main location block | ||
location / { | ||
try_files $uri $uri/ /index.php?$query_string; | ||
} | ||
|
||
client_max_body_size 200M; | ||
location ~ ^/index.php(/|$) { | ||
fastcgi_pass php-upstream; | ||
fastcgi_split_path_info ^(.+\.php)(/.*)$; | ||
# PHP-FPM handling | ||
location ~ \.php$ { | ||
include fastcgi_params; | ||
fastcgi_pass php-upstream; # This matches the upstream definition | ||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | ||
fastcgi_param HTTPS off; | ||
client_max_body_size 200M; | ||
fastcgi_read_timeout 600; | ||
include fastcgi_params; | ||
} | ||
|
||
error_log /var/log/nginx/symfony_error.log; | ||
access_log /var/log/nginx/symfony_access.log; | ||
# Logs (optional) | ||
error_log /var/log/nginx/error.log; | ||
access_log /var/log/nginx/access.log; | ||
} |