I have an Ubuntu 20.04 LTS server with NGINX, Wordpress and GeoServer (deployed on Tomcat) installed.
I would like to have the Wordpress site available on the URL root foo.bar.com/ and have the GeoServer available on a subpath foo.bar.com/geoserver. The Wordpress site is working and shows up on foo.bar.com/, but the GeoServer isn't working correctly on foo.bar.com/geoserver, see screenshot below.
I have the following NGINX configuration:
server {
server_name foo.bar.com;
root /var/www/site;
index index.html index.htm index.php;
location /geoserver/ {
proxy_pass http://localhost:8080/geoserver/;
proxy_pass_header Set-Cookie;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location / {
#try_files $uri $uri/ =404;
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
}
location ~ /\.ht {
deny all;
}
location = /favicon.ico { log_not_found off; access_log off; }
location = /robots.txt { log_not_found off; access_log off; allow all; }
location ~* \.(css|gif|ico|jpeg|jpg|js|png)$ {
expires max;
log_not_found off;
}
listen 443 ssl; # managed by Certbot
ssl_certificate ***; # managed by Certbot
ssl_certificate_key ***; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = foo.bar.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name foo.bar.com;
return 404; # managed by Certbot
}
I did set the proxy base URL in the GeoServer global settings and did configure CSRF protection conform this document.
Am i still missing some configuration in NGINX?