I have installed a picture service named Picsur with docker image. It works fine at http://127.0.0.1:8888. I have only one FQDN host http://www.example.com/. I can’t configure a name-based host like http://pic.example.com/ to service the picture service . So i decide to configure nginx reverse proxy like this:
http://www.example.com/pic/ –> http://127.0.0.1:8888
My nginx configuration like this :
server {
listen 443 ssl;
ssl_certificate /etc/letsencrypt/live/www.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/www.example.com/privkey.pem;
server_name www.example.com;
access_log /var/log/nginx/p_access.log;
error_log /var/log/nginx/p_error.log;
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location / {
root /data/www/portal;
index index.php index.html index.htm;
}
location /pic {
rewrite ^/pic/(.*) /$1 break;
proxy_pass http://127.0.0.1:8888;
}
}
I can’t adapted the url inside the picsur docker. So the resources in the page inside like /assets/css/xxx.css
are not rewrite to /pic/assets/css/xxx.css
. The reverse proxy are not working like what i want.
I have read some post like this. But they can adapt the blog config to alter the url to /blog/ . But i don’t want to adapt the docker config. How can i change the nginx proxy config?