跳到主內容

Docker安裝Drupal 11 及 Php8.3環境

Yaml這樣寫

# Drupal 11 with MySQL and PHP 8.3
#
# Access via "http://localhost:8080"
#   (or "http://$(docker-machine ip):8080" if using docker-machine)
#
# During initial Drupal setup,
# Database type: MySQL
# Database name: drupal
# Database username: root
# Database password: example
# ADVANCED OPTIONS; Database host: mysql
version: '3.1'
services:
 drupal:
   image: drupal:11-apache
   ports:
     - 8080:80
   environment:
     PHP_VERSION: "8.3"
   volumes:
     - /var/www/html/modules
     - /var/www/html/profiles
     - /var/www/html/themes
     - /var/www/html/sites
   restart: always
 mysql:
   image: mysql:8.0
   environment:
     MYSQL_ROOT_PASSWORD: example
     MYSQL_DATABASE: drupal
   restart: always

Nginx conf

server {
   server_name www.yoursite.com;
   location / {
       proxy_pass http://127.0.0.1:8080;
       proxy_set_header Host $host;
       proxy_set_header X-Real-IP $remote_addr;
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
       proxy_set_header X-Forwarded-Proto $scheme;
   }
}