nginx reverse proxy uses multiple location URLs to match different services on different hosts, resulting in a 404 problem.
为情所困
为情所困 2017-05-16 17:10:20
0
1
1056

There are two existing service application addresses:
192.168.5.20:5080 jenkins
192.168.5.20:2080 gitlab

I want to deploy nginx reverse proxy on 192.168.0.161 (another machine) and configure two locations, pointing to the above two addresses respectively, but a 404 error always occurs.

Configuration as follows:

Phenomena:
When accessing: 192.168.5.161/jenkins from the browser:
The browser address bar changes to: 192.168.5.161/login?from=%2F
The page displays 404

Purpose:
When accessing 192.168.5.161/jenkins, the browser URL address remains unchanged, and the page is forwarded to 192.168.5.20:5080, which is the service where Jenkins is located. How do I change the configuration?

为情所困
为情所困

reply all(1)
Peter_Zhu

If your Jenkins/GitLab does not support configuring to add something to the URL path, then don’t try this again. nginx can do redirect rewriting, but there may also be absolute path links in the web page. Even if you rewrite the web page, the web page may still be constructed into wrong links through JavaScript.

You can configure two domain names (vhosts) to provide different services.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template