add dockerfile and config

This commit is contained in:
2024-11-02 17:32:33 +03:00
commit 34148ff7d3
3 changed files with 63 additions and 0 deletions

13
docker-compose.yml Normal file
View File

@@ -0,0 +1,13 @@
services:
nginx:
build:
context: ./docker
dockerfile: Dockerfile
image: bitdeals/nginx
volumes:
- php_socket:/run
- storage:/app/storage/:ro
- public:/app/public/:ro
depends_on:
- php-app

5
docker/Dockerfile Normal file
View File

@@ -0,0 +1,5 @@
FROM bitnami/nginx:latest
# Copy config
COPY ./docker/nginx.conf /opt/bitnami/nginx/conf/server_blocks/nginx.conf

45
docker/nginx.conf Normal file
View File

@@ -0,0 +1,45 @@
server {
listen 80 default_server;
server_name _;
root /app/public;
#add_header X-Frame-Options "SAMEORIGIN";
#add_header X-XSS-Protection "1; mode=block";
#add_header X-Content-Type-Options "nosniff";
#add_header X-Forwarded-Proto https;
add_header 'Access-Control-Allow-Origin' '*';
index index.html index.htm index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
#error_log /var/log/nginx/container_error.log;
#access_log /var/log/nginx/container_access.log;
error_page 404 /index.php;
location ~ \.php$ {
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
#fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php-fpm.sock;
#fastcgi_pass php-app:9000;
fastcgi_index index.php;
include fastcgi_params;
}
location ~ /\.(?!well-known).* {
deny all;
}
}