Replace Unit configuration with Nginx + PHP-FPM setup in Docker
- Remove outdated Unit-based Docker configuration and scripts. - Introduce Nginx + PHP-FPM stack with environment-based configurations. - Add custom Nginx setup for frontend-backend routing. - Update Dockerfiles, Docker Compose, and related scripts for new architecture.
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
map $FRONTEND_PORT $host_with_port {
|
||||
"" $host;
|
||||
default "$host:$FRONTEND_PORT";
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80 default_server;
|
||||
listen [::]:80 default_server;
|
||||
|
||||
client_max_body_size ${NGINX_CLIENT_MAX_BODY_SIZE};
|
||||
|
||||
disable_symlinks if_not_owner from=/usr/share/nginx/html;
|
||||
|
||||
index index.php index.html;
|
||||
root /usr/share/nginx/html;
|
||||
|
||||
${GZIP_BLOCK}
|
||||
${REAL_IP_BLOCK}
|
||||
|
||||
location / {
|
||||
location / {
|
||||
try_files $uri @fallback;
|
||||
}
|
||||
location ~ \.php$ {
|
||||
return 404;
|
||||
}
|
||||
location ~ /\. {
|
||||
return 404;
|
||||
}
|
||||
location ~ /\.(ht|svn|git) {
|
||||
return 404;
|
||||
}
|
||||
}
|
||||
|
||||
location @fallback {
|
||||
fastcgi_pass ${BACKEND_HOST}:${BACKEND_PORT};
|
||||
fastcgi_index index.php;
|
||||
fastcgi_param REDIRECT_STATUS 200;
|
||||
fastcgi_param SCRIPT_FILENAME /var/www/html/public/index.php;
|
||||
fastcgi_param SCRIPT_NAME /index.php;
|
||||
fastcgi_param HTTP_HOST $host_with_port;
|
||||
include /etc/nginx/fastcgi_params;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
fastcgi_param QUERY_STRING $query_string;
|
||||
fastcgi_param REQUEST_METHOD $request_method;
|
||||
fastcgi_param CONTENT_TYPE $content_type;
|
||||
fastcgi_param CONTENT_LENGTH $content_length;
|
||||
|
||||
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
|
||||
fastcgi_param REQUEST_URI $request_uri;
|
||||
fastcgi_param DOCUMENT_URI $document_uri;
|
||||
fastcgi_param DOCUMENT_ROOT $document_root;
|
||||
fastcgi_param SERVER_PROTOCOL $server_protocol;
|
||||
fastcgi_param HTTPS $https if_not_empty;
|
||||
|
||||
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
|
||||
fastcgi_param SERVER_SOFTWARE nginx;
|
||||
|
||||
fastcgi_param REMOTE_ADDR $remote_addr;
|
||||
fastcgi_param REMOTE_PORT $remote_port;
|
||||
fastcgi_param SERVER_ADDR $server_addr;
|
||||
fastcgi_param SERVER_PORT $server_port;
|
||||
fastcgi_param SERVER_NAME $server_name;
|
||||
|
||||
fastcgi_param HTTP_X_FORWARDED_FOR $proxy_add_x_forwarded_for;
|
||||
fastcgi_param HTTP_X_REAL_IP $remote_addr;
|
||||
Reference in New Issue
Block a user