Update docker nginx configuration

This commit is contained in:
Fred Boniface 2023-01-13 13:54:34 +00:00
parent deb0156c1b
commit b91381e822
2 changed files with 56 additions and 18 deletions

View File

@ -1,4 +1,4 @@
FROM nginx:mainline-alpine-slim FROM nginx:mainline-alpine-slim
RUN rm /etc/nginx/nginx.conf
COPY ./nginx.conf /etc/nginx/nginx.conf
COPY . /site COPY . /site
COPY ./nginx.conf /etc/nginx/conf.d/site.conf

View File

@ -1,17 +1,55 @@
server { user nginx;
index index.php index.html; worker_processes auto;
server_name fredboniface.co.uk.local;
error_log /var/log/nginx/error.log; error_log /var/log/nginx/error.log notice;
access_log /var/log/nginx/access.log; pid /var/run/nginx.pid;
root /site;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
keepalive_timeout 65;
gzip on;
server {
listen 80;
server_name localhost;
access_log /var/log/nginx/access.log;
root /site;
location ~ /(.git|php|page-blocks) {
deny all;
}
location / {
index index.php;
try_files $uri $uri/ $uri/index.php &uri/index.html =404;
break;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass localhost:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
error_page 403 /error-pages/403.php;
error_page 404 /error-pages/404.php;
error_page 500 501 502 503 504 /error-pages/50x.html;
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass localhost:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
} }
} }