Wednesday, September 27, 2017

How to configure Wordpress to run on Docker

Well, it's not a big deal. You need two (2) things.
#1. This Nginx config
server {
    listen 80;
    server_name wp-hakase.co;
 
    root /var/www/html;
    index index.php;
 
    access_log /var/log/nginx/hakase-access.log;
    error_log /var/log/nginx/hakase-error.log;
 
    location / {
        try_files $uri $uri/ /index.php?$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;
    }
}
#2 You have to make sure your PHP instance (docker) has mysqli installed (or installing via DockerFile) everytime.

Credits: https://www.howtoforge.com/tutorial/dockerizing-wordpress-with-nginx-and-php-fpm/
https://forums.docker.com/t/status-code-500-wordpress/36581

No comments:

Post a Comment

Post your comment here. If you want to say something about programming problems, scripts, software etc, please try to be as descriptive as possible.

Connect Rapoo MT750S with Linux (Tested on Manjaro)

 I bought this obvious copy of MX Master 2S in hopes of having the device switching functionality along with a lightweight body because I ha...