I try to install WordPress on an nginx docker container. my domain
blog.example.com
points to the ip
xxx.xxx.xxx.xx/wordpress/
the backend is working like a charm with a domain like this:
blog.example.com/wp-admin/options-permalink.php
In the Frontend when i want to visit my page it automatically switches
blog.example.com
to
blog.example.com/wordpress
my nginx config looks like this:
server {
listen 80;
server_name blog.example.com;
root /var/www/;
index index.php;
location /wordpress/{
try_files $uri $uri/ /wordpress/index.php;
}
location ~\.php${
try_files $uri =404;
fastcgi_split_path_info ⁽.+\.php)(/.+)$;
fastcgi_pass php:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_param REQUEST_URI $args;
include fastcgi_params;
}
}
WP seems to be installed to /var/www
, not /var/www/wordpress
.
Your location
block needs to be.
location / {
try_files $uri $uri/ /index.php?$args;
}
In addition, there is a lot more to running a WordPress site via nginx. WPORG has a guide.