Nginx rewrite add base url

this is my current setting,

location /jenkins {                                                                                                                                                                                  
                -sharp First attempt to serve request as file, then                                                                                                                                                               -sharp as directory, then fall back to displaying a 404.                                                                                                                                          
                -sharp try_files $uri $uri/ =404;                                                                                                                                                                 
                include             /etc/nginx/proxy_params;                                                                                                                                                 
                proxy_pass          http://localhost:8080/;                                                                                                                                                  
                proxy_read_timeout  90s;                                                                                                                                                                     
                -sharp Fix potential "It appears that your reverse proxy set up is broken" error.                                                                                                                 
                proxy_redirect      http://localhost:8080/ http://www.example.com/jenkins;                                                                                                                
        }

with this setting, I can access http://www.example.com/jenkins, but all the requests in it is that leads to http://www.example.com/. In fact, it should be directed to http://www.example.com/jenkins, so how to write rewrite rule, so that only / jenkins will not be changed, and other url will add / jenkins/?

in front of it.
Mar.28,2021

you must keep the prefix consistent, otherwise you can't simply reverse proxy.

if you expect to access jenkins, through / jenkins on nginx, then your backend jenkins access path must also be / jenkins . As for how to change this prefix, the official document is very clear, so I will not repeat it: https://wiki.jenkins.io/displ.

finally, nginx reverse proxy reference is available in the official documentation: https://wiki.jenkins.io/displ.

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3b39c-34628.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3b39c-34628.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?