I have a site https://example.com running on instance 1 on AWS EC2: nginx + wildfly app server
Everything works fine. Nginx proxy passes to wildfly. Https is configured.
I would like to set up wordpress running on different EC2 instance so it is accessible via https://example.com/blog
I set up dedicated instance for wordpress and launched wordpress using docker compose as described here: https://docs.docker.com/compose/wordpress/ I configured composer so wordpress is accessible via 80 port on that instance.
I configured ngnix as following:
server {
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
server_name <server_name>;
root /usr/share/nginx/html;
ssl_certificate "/etc/ssl/certs/<path_to_cert>/ssl-bundle.crt";
ssl_certificate_key "/etc/ssl/certs/<path_to_cert>/private.key";
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 10m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:SEED:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!RSAPSK:!aDH:!aECDH:!EDH-DSS-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA:!SRP;
ssl_prefer_server_ciphers on;
include /etc/nginx/default.d/*.conf;
# main site, deployed on same instance as nginx
location / {
proxy_pass http://127.0.0.1:8080;
}
# wordpress, deployed on other instance
location /blog/ {
proxy_pass http://<my_wordpress_instance_local_ip>/;
proxy_set_header X-Forwarded-Proto $scheme;
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
I installed wordpress (using direct access to it) and configured WordPress Address (URL) and Site Address (URL) to be "https://example.com/blog" both.
Now I can access admin and home page https://example.com/blog fine. But when I click to see test "Hello World" post (url: https://example.com/blog/2018/09/28/hello-world/) I get 500 Internal Server error.
I looked at wordpress docker log and found following error: "[Fri Sep 28 18:17:25.721177 2018] [core:error] [pid 308] [client :47792] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace., referer: https://example.com/blog/ "
How can I fix that? Disclaimer: I have no big experience in nginx, not in wordpress, so sorry for maybe stupid question. I tried different options I found on the internet but all of them are either not working or describe manual wordpress setup (not via standard docker image).
UPDATES:
I updated description of nginx conf: now the whole configuration is provided;
My Wordpress Permalink setting is "Day and name". I tried all of them and found that if I switch to "Plain" - everything works with no error. All other settings cause error. Obviously "Plain" does not work me and I would like to proceed with something better than that.