Skip to content

Instantly share code, notes, and snippets.

@dbazhenov
Last active February 20, 2023 08:34
Show Gist options
  • Select an option

  • Save dbazhenov/4d9a5f41bb8e0674751eebaed95bd368 to your computer and use it in GitHub Desktop.

Select an option

Save dbazhenov/4d9a5f41bb8e0674751eebaed95bd368 to your computer and use it in GitHub Desktop.
Nginx + PHP 8.2 + MongoDB 6 + Composer
{
"require": {
"guzzlehttp/guzzle": "^7.0",
"nikic/fast-route": "^1.3",
"mongodb/mongodb": "^1.15",
"ext-mongodb": "^1.6",
"larapack/dd": "^1"
}
}
server {
listen 80;
server_name localhost;
index index.php index.html;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
root /var/www/html;
rewrite ^/(.*)/$ /$1 permanent;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php-fpm:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}
version: '3.9'
services:
web:
image: nginx:latest
ports:
- '80:80'
volumes:
- ./src:/var/www/html
- ./default.conf:/etc/nginx/conf.d/default.conf
php-fpm:
image: php8-mongodb
volumes:
- ./src:/var/www/html
psmdb:
image: "percona/percona-server-mongodb:6.0.4"
volumes:
- ./data:/data/db
restart: always
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: secret
MONGO_INITDB_DATABASE: database
ports:
- "27017:27017"
# composer:
# image: composer/composer
# command: install
# volumes:
# - ./src:/var/www/html
# working_dir: /var/www/html
FROM php:8.2-fpm
# Use the default production configuration
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
RUN apt-get update
RUN apt-get install -y libssl-dev pkg-config git
RUN apt-get install -y unzip
RUN pecl install mongodb \
&& docker-php-ext-enable mongodb
# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
@vladsf
Copy link
Copy Markdown

vladsf commented Feb 20, 2023

coNposer?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment