Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

404 error when changing NEXUS_CONTEXT environment variable #60

Open
nghamilton opened this issue Aug 30, 2017 · 2 comments
Open

404 error when changing NEXUS_CONTEXT environment variable #60

nghamilton opened this issue Aug 30, 2017 · 2 comments

Comments

@nghamilton
Copy link

nghamilton commented Aug 30, 2017

Setting the context path using NEXUS_CONTEXT causes a 404 error when using the nexus3 image:

Problem accessing /. Reason: Not Found

The logs indicate it is set properly (using NEXUS_CONTEXT=nexus/content)

nexus-context-path='/nexus/content'

@virtualbeck
Copy link

If you pass an environment variable at launch, this will set the context path correctly as shown in the logs:
org.sonatype.nexus.bootstrap.ConfigurationBuilder - nexus-webapp-context-path='/'

From the notes section of the readme:

Environment variables can be used to control the JVM arguments

CONTEXT_PATH, passed as -Dnexus-webapp-context-path. This is used to define the URL which Nexus is accessed. Defaults to '/nexus'

So try this and see if it works for you:
docker run -d -p 8081:8081 --name nexus -e CONTEXT_PATH=/ sonatype/nexus
That should work on localhost:8081

@srknc
Copy link

srknc commented Oct 12, 2019

Just for future reference, the main issue here is / at CONTEXT_PATH environment variable.
./etc/nexus.properties file sets nexus-context-path as below;

nexus-context-path=/${NEXUS_CONTEXT}

So if you set CONTEXT_PATH=/nexus nexus starts with log below;

INFO [FelixStartLevel] *SYSTEM org.sonatype.nexus.bootstrap.ConfigurationBuilder - nexus-context-path='//nexus'

So curl localhost:8081/nexus fails
but
curl localhost:8081//nexus works.

So, solution is setting NEXUS_CONTEXT as nexus, without /

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants