java -Xms512m -Xmx2048m -Dstorage.diskCache.bufferSize=256 -DTRACE=DEBUG -Dserver.contextPath=/medium -Duser.home=/media/sda/picapport -jar /media/sda/picapport/picapport-headless.jar
Wird nun der server.contextpath gesetzt ändert sich dies wie folgt:
server.contextpath=/medium
$ grep -i "terminator\|medium" /media/sda/picapport/.picapport/logfiles/picapport.004
MSG @ 20:07:21.883 java.runtime.argument: -Dserver.servlet.contextPath=/medium
MSG @ 20:07:21.883 java.runtime.argument: -Dserver.contextPath=/terminator
DEBUG@ 20:07:21.962 PicApportRestartHandler.init: vmargs[12]=-Dserver.servlet.contextPath=/medium
DEBUG@ 20:07:21.962 PicApportRestartHandler.init: vmargs[13]=-Dserver.contextPath=/terminator
location ~ ^/medium(.*)$ {
set $query $1; # https://stackoverflow.com/questions/8838905/how-to-avoid-nginx-to-replace-20-by-whitespace-when-using-as-a-proxy-proxy-pas
proxy_http_version 1.1;
proxy_pass http://192.168.178.90/medium$query$is_args$args;
proxy_redirect http://192.168.178.90/medium http://$host/medium;
proxy_set_header Referer http://192.168.178.90:8080/medium/picapport;
proxy_set_header Host 192.168.178.90:8080;
proxy_set_header Connection "";
#proxy_set_header Accept-Encoding "gzip, deflate, br";
#proxy_set_header Connection "keep-alive";
access_log /var/log/nginx/picapport.log;
}
location ~ /notmedium/ {
proxy_set_header Authorization "Basic dXNlcm5hbWU6cGFzc3dvcnQ="; #encode base64 user & pw are fakes here
proxy_pass http://192.168.178.90:8080/picapport$is_args$args;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-User $http_authorization;
server.contextPath
$ cat picapport.properties
server.port=8080
...
...
server.contextpath=/myalbum # careful: even in other external guides they use other spelling like contextPath or context-path
$ grep -i myalbum /media/sda/picapport/.picapport/logfiles/picapport.00*
DEBUG@ 12:07:23.414 GenProperties.getProperty: Key=server.contextpath value=/myalbum
INFO @ 12:07:23.442 PicApportServlet.initServletPathWithContext:/myalbum/picapport #<---- Works!
MSG @ 12:07:23.476 Init: server.contextpath=/myalbum
location /myalbum/ {
proxy_pass http://192.168.178.90:8080/myalbum/;
http2_push_preload on; # disable it , if you don't use http2
proxy_http_version 1.1; # default proxy http version = 1.0