0

I have deployed a stack with wordpress and mariadb. If I try to access directly to the website with IP address and port it works but when i configure the reverse porxy with nginx it doesn't load the entire content. Maybe because of php loading or something else. Nginx is directly installed into the server as a service while wordpress is containerized into a stack This is the docker-compose.yml file

version: '3.1'
    
services:
    
  wordpress:
    image: wordpress
    restart: always
    ports:
      - 8080:80
      - 9001:9000
    environment:
      WORDPRESS_DB_HOST: db
      WORDPRESS_DB_USER: root
      WORDPRESS_DB_PASSWORD: root
      WORDPRESS_DB_NAME: db_name
    volumes:
      - /home/ubuntu/website/dir:/var/www/html
    
  db:
    image: mariadb
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_DATABASE: db_name
    volumes:
      - /home/ubuntu/website/data:/var/lib/mysql

while this is the nginx configuration file

server{
        listen 443 ssl;
        server_name website.domain.it;
        ssl_certificate /etc/letsencrypt/live/website.domain.it/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/website.domain.it/privkey.pem;
        location / {
                proxy_set_header X-Real-IP $remote_addr;
                proxy_pass http://localhost:8080;
        }
}
server{
        listen 80;
        server_name website.domain.it;
        return 301 https://website.domain.it$request_uri;
}

I've seen some other deployment with nginx, wordpress and mariadb in a stack with a strange configuration(not really explicative) but I want to deploy it with the already existent Nginx. If it is not possible, I need a well written documentation to deploy with Nginx, Wordpress and Mariadb and then configure the nginx in the server.

masseyb
  • 3,745
  • 1
  • 17
  • 29
pingmyheart
  • 27
  • 1
  • 7
  • The `latest` `wordpress` tag is [`wordpress` with `apache`](https://github.com/docker-library/wordpress/blob/394c79eafd5b345514f87cec590577e641c030ef/latest/php7.4/apache/Dockerfile) - are trying to proxy from `nginx` -> `apache` -> `wordpress`? – masseyb Apr 17 '21 at 11:51
  • I'm not sure about the tag but yes cause the exposed port of wordpress is mapped with the internal 80 – pingmyheart Apr 17 '21 at 12:47

0 Answers0