Commit edef1e3f authored by Fabrice's avatar Fabrice
Browse files

Ajout Wordpress

parent 08c08ec9
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -3,5 +3,7 @@ Configurations Docker
- Symfony-gtfs : Symfony 6 + PHP 8 Apache + https
- Symfony + API Platform : PHP 8 Apache + https 
- Wordpress 
  - un fonctionnel nginx https
  - un non fonctionnel avec Certbot (on en avait pas besoin finalement)
- Sonarqube
- Elasticsearch avec https
 No newline at end of file
+62 −0
Original line number Diff line number Diff line
version: '3'
services:
  db:
    image: mysql:8.0
    container_name: db
    restart: unless-stopped
    command: '--default-authentication-plugin=mysql_native_password'
    env_file: .env
    environment:
      - MYSQL_DATABASE=wordpress
    volumes: 
      - dbdata:/var/lib/mysql

  wordpress:
    image: wordpress:5-fpm-alpine
    depends_on:
      - db
    container_name: wordpress
    restart: unless-stopped
    volumes:
      - wordpress:/var/www/html
      #- /path/to/repo/myTheme/:/var/www/html/wp-content/themes/myTheme
    env_file: .env
    environment:
      - WORDPRESS_DB_HOST=db:3306
      - WORDPRESS_DB_USER=$MYSQL_USER
      - WORDPRESS_DB_PASSWORD=$MYSQL_PASSWORD
      - WORDPRESS_DB_NAME=wordpress
  webserver:
    depends_on:
      - wordpress
    image: nginx:1.15.12-alpine
    container_name: webserver
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - wordpress:/var/www/html
      - /root/dockerv2/nginx/:/etc/nginx/conf.d
      #- certbotdata:/etc/letsencrypt
    networks:
      - app-network

  #certbot:
  #  depends_on:
  #    - webserver
  #  image: certbot/certbot
  #  container_name: certbot
  #  volumes:
  #    - certbotdata:/etc/letsencrypt
  #    - wordpress:/var/www/html
  #  command: certonly --webroot --webroot-path=/var/www/html --email fabrice.missonnier@ac-clermont.fr --agree-tos --no-eff-email --force-renewal -d gsb-aurillac.fr -d www.gsb-aurillac.fr

networks:
  app-network:

volumes:
  wordpress:
  dbdata:
  #certbotdata:
+59 −0
Original line number Diff line number Diff line
# nginx-conf/nginx.conf 
# redirect to HTTPS ( optional )
server {
  listen 80;
  listen [::]:80;
   server_name domain.com www.domain.com;
   location ~ /.well-known/acme-challenge {
          allow all;
          root /var/www/html;
  }
  location / {
          rewrite ^ https://$host$request_uri? permanent;
  }
}
server {
  listen 443 ssl http2;
  listen [::]:443 ssl http2;
  server_name domain.com www.domain.com;
  index index.php index.html index.htm;
  root /var/www/html;
  server_tokens off;
  # add our paths for the certificates Certbot created 
  ssl_certificate /etc/letsencrypt/live/domain.com/fullchain.pem;
  ssl_certificate_key /etc/letsencrypt/live/www.domain.com/privkey.pem;
  # some security headers ( optional )
 add_header X-Frame-Options "SAMEORIGIN" always;
 add_header X-XSS-Protection "1; mode=block" always;
 add_header X-Content-Type-Options "nosniff" always;
 add_header Referrer-Policy "no-referrer-when-downgrade" always;
 add_header Content-Security-Policy "default-src * data: 'unsafe-eval' 'unsafe-inline'" always;
  location / {
          try_files $uri $uri/ /index.php$is_args$args;
  }
  location ~ \.php$ {
          try_files $uri =404;
          fastcgi_split_path_info ^(.+\.php)(/.+)$;
          fastcgi_pass wordpress: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 ~ /\.ht {
          deny all;
  }
   location = /favicon.ico { 
          log_not_found off; access_log off; 
  }
  location = /favicon.svg { 
          log_not_found off; access_log off; 
  }
  location = /robots.txt { 
          log_not_found off; access_log off; allow all; 
  }
  location ~* \.(css|gif|ico|jpeg|jpg|js|png)$ {
          expires max;
          log_not_found off;
  }
}
+32 −0
Original line number Diff line number Diff line
version: "3.9"
    
services:
  db:
    image: mysql:5.7
    volumes:
      - db_data:/var/lib/mysql
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: wordpressgene 
      MYSQL_DATABASE: wordpress
      MYSQL_USER: wordpress
      MYSQL_PASSWORD: wordpressgene
    
  wordpress:
    depends_on:
      - db
    image: wordpress:latest
    volumes:
      - wordpress_data:/var/www/html
    ports:
      - "8000:80"
      - "443:443"   
    restart: always
    environment:
      WORDPRESS_DB_HOST: db
      WORDPRESS_DB_USER: wordpress
      WORDPRESS_DB_PASSWORD: wordpressgene
      WORDPRESS_DB_NAME: wordpress
volumes:
  db_data: {}
  wordpress_data: {}