I have an nginx reverse proxy that is using stream proxy to direct to a web page that uses NTLM authentication, but I need to use something similar to the location directive to tell this reverse proxy to send requests to that site to a specific IRL. For example, if a user were to request this site:
I would like this to forward on to http://mysite.mydomain.com/xyz
Normally I would use location directive, but any time I add the location directive into my current config, I get the error "location" directive is not allowed here in /opt/nginx/nginx.conf:43
My current config (which is contains lots of stuff I've never done before due to the NTLM issues I've had), is shown below
/opt/nginx/nginx.conf
worker_processes 1;
events {
worker_connections 1024;
}
stream {
upstream backend {
hash $remote_addr consistent;
server mysite.mydomain.com:80 weight=5;
server 192.168.0.50:80 max_fails=3 fail_timeout=30s;
}
server {
listen 443 ssl;
ssl_certificate /usr/local/nginx/conf/mydomain.com.crt;
ssl_certificate_key /usr/local/nginx/conf/mydomain.com.key;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 5m;
proxy_connect_timeout 1s;
proxy_timeout 3s;
proxy_pass backend;
}
}
I'm not sure how to add the /xyz URI. If I add it to the end of any ip's in this file, that's wrong, and if I try adding a location directive inside of the server section, I get that error.
Of course, Ideally, this would actually forward to any extension they put at the end of the url, and try that, for example /abc, or /xyz, would forward to http://mysite.mydomain.com/abc, and http://mysite.mydomain.com/xyz respectively. Any help is appreciated.