Serve virtuoso opensource behind a nginx proxy - nginx

I have a virtuoso-opensource instance on localhost:8890
I have configured a nginx proxy to redirect at localhost/virtuoso
location /virtuoso {
proxy_pass http://localhost:8890/;
proxy_set_header Host localhost;
}
The main page of virtuoso is redirected but CSS and images are not. And when a go to /virtuoso/conductor, it redirect me to /conductor.
how can I properly configure nginx to get the right redirection?

Related

Upstream server always redirects back to root path in Nginx reverse proxy configuration

I plan to run an pgAdmin4 instance behind Nginx reverse proxy.
What I want is requests coming to http://myhost.com/pgadmin4 should be forwarded to upstream http://localhost:8087 where pgAdmin is listening.
To achieve this, I followed this nginx.conf recipe from pgAdmin's official doc. Here's the snippet:
server {
listen 80;
server_name myhost.com;
location /pgadmin4/ {
proxy_set_header X-Script-Name /pgadmin4;
proxy_set_header Host $host;
proxy_pass http://localhost:8087/;
proxy_redirect off;
}
}
Everything works fine except that after successful login, the server sends HTTP 301 response with location header sets to root path (i.e. "Location: /") aand bam, user agent is redirected to http://myhost.com/ where nothing is waiting (except nginx default page, for now).
Retyping the url to http://myhost.com/pgadmin4/ is still okay. The user agent's state, cookies and all are all set and user can continue as normal. It's just that it's a mild annoyance for end users having to retype the whole URL again.
I know that I can alter upstream's HTTP redirect response by using proxy_redirect directive, but I can't figure out what the value should be.
Is what I'm trying to do achievable from just by Nginx configuration? Is there any specific PgAdmin4 config that I need to change?

Nginx rewrite urls to match proxy address

I am running a wordpress docker container , the site is accessible through host machines port 8000 , if go to localhost:8000 boom i get to see my wordpress site.
It's boring to always type localhost:8000 to see my website, so i decided to commission nginx as a reverse proxy for my site. I've set up a virtual host in nginx that has the name proxy.site , i can now access by wordpress site by visiting http://proxy.site.
Up until this point, we are doing great, when http://proxy.site opens up, i can see a list of my blog posts, lets say i want to read my latest blog post about COVID-19 , when i click on the link, ohohohoho it opens up as http://localhost:8000/posts/covid19
I want it to open with the proxy url as in http://proxy.site/posts/covid19 , i need to whole site to be accessible through the http://proxy.site site name,
I need nginx to rewrite all my links in localhost:8000/* to proxy.site/* , no body loves typing ports when accessing a blog,
Here is how my nginx conf file looks like
server {
listen 80;
listen [::]:80;
root /var/www/proxy.site/html;
index index.html index.htm index.nginx-debian.html;
server_name proxy.site www.proxy.site;
location / {
proxy_pass http://localhost:8000;
#proxy_set_header HOST $host;
#proxy_redirect http://localhost:8000/ http://proxy.site/ ;
#try_files $uri $uri/ =404;
}
}
How do i achieve rewrite all urls in the proxied site with my custom host name ?
Nginx does not listen to localhost:8080, nginx will not inspect links from your site to rewrite them, you should find a way on WordPress to replace base url of your links.based on the environment

Nginx proxy pass(rewrite/ redirect) to specific page on app server

Currently,
https:// example.com proxy_pass port 8080 via Nginx to : https:// example.com/app/index.py
Configuration file :
location / {
proxy_ignore_client_abort on;
proxy_pass https://ip_address_app:8080/;
/app/index.py is default loading page on application server.
Now, I would like to rewrite/ redirect or proxy_pass to non-default loading page from :
https:// example.com -- > Nginx --> https:// example.com/app/xyz.py
I have tried rewrite , proxy_redirect and proxy_pass but it didnot work as expect.
I dont have permission to change anything on app server.
Please advise.
Thank you,

Nginx proxy pass (not redirect)

I have a nginx server that runs drupal. We're changing the way our site runs. I want user.redangus.org to pull up the same page that is at redangus.org/user.
My nginx right now is resulting in a redirect to redangus.org/user, but I want the URL to stay as user.redangus.org
My nginx for this currently looks like:
# user.redangus.org
server {
listen 80;
server_name user.redangus.org;
location / {
proxy_pass http://127.0.0.1/user$request_uri;
proxy_set_header Host redangus.org;
}
}
How do I get it to pull the page without redirecting to the page?

How to rewrite URL to match a server using nginx?

I'm new to nginx. I have two projects, and the one is django web app which is running localhost 8000, and another is tornado which used to provide api service and running localhost 8888.
How do I config the nginx that redirects all the url requests(from 80 port) to localhost:8000 but /api requests to localhost:8888(tornado app)?
Edit your nginx config file. Add a server block and use proxy_pass in location blocks to proxy (redirect) the request.
server {
listen 80;
location / {
proxy_pass http://127.0.0.1:8000;
}
location /api {
proxy_pass http://127.0.0.1:8888;
}
}
Save it, and reload nginx.
nginx -s reload
https://gist.github.com/soheilhy/8b94347ff8336d971ad0

Resources