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.