حسن عسکری
حسن عسکری
خواندن ۱ دقیقه·۱ سال پیش

داکر کامپوز برای وردپرس

version: '3.3'
services:
#PHP Service
php:
build:
context: ./php
dockerfile: Dockerfile
container_name: wp_php
restart: unless-stopped
working_dir: /var/www
volumes:
- .:/var/www
#Nginx Service
nginx:
image: nginx:1.19.6
container_name: wp_nginx
restart: unless-stopped
ports:
- &quot80:80&quot
volumes:
- .:/var/www
- ./nginx/conf.d/:/etc/nginx/conf.d/
#MySQL Service
db:
image: mysql:8.0.23
container_name: wp_db
restart: unless-stopped
ports:
- &quot3306:3306&quot
environment:
MYSQL_DATABASE: wp
MYSQL_ROOT_PASSWORD: 123
volumes:
- ./mysql/data:/var/lib/mysql


فایل داکر

FROM php:8.0.12-fpm-bullseye
RUN apt update && apt install zip unzip git -y
RUN docker-php-ext-install mysqli pdo pdo_mysql
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN apt-get install zlib1g-dev libwebp-dev libfreetype6-dev libjpeg-dev libpng-dev -y \
&& docker-php-ext-configure gd --enable-gd --with-freetype --with-jpeg --with-webp \
&& docker-php-ext-install gd
RUN docker-php-ext-install exif
RUN apt-get update && apt-get install -y libmagickwand-dev --no-install-recommends && rm -rf /var/lib/apt/lists/*
RUN curl -sL https://deb.nodesource.com/setup_16.x | bash -
RUN apt install -y nodejs
RUN npm install --global yarn


فایل انجنیکس

server {
listen 80;
index index.php index.html;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
root /var/www/wp;
location ~ \.php$ {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,authorization';
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain; charset=utf-8';
add_header 'Content-Length' 0;
return 204;
}
if ($request_method = 'POST') {
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,authorization' always;
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always;
}
if ($request_method = 'GET') {
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,authorization' always;
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always;
}
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
location / {
try_files $uri $uri/ /index.php?$query_string;
gzip_static on;
}
}
داکروردپرسبرنامه نویسینصب داکربرنامه نویس
شاید از این پست‌ها خوشتان بیاید