nginx proxy_pass serving from default path other than application's - nginx

I'm running a local web service listening on port 8888
server {
listen 80;
server_name dracut.site;
location /jupyter {
proxy_pass http://127.0.0.1:8888/;
}
}
When I access http://dracut.site/jupyter, nginx is using files under /etc/nginx and returns error.
"/etc/nginx/html/tree" failed (2: No such file or directory)
Files should be served from the app listening on port 8888, how can I configure it.

your desciption is not complete...
you're using static html?
then want nginx to serve it...
just define root then location tag to that root

Related

Nginx Proxy Pass dont acceppts user & password

i need to proxy pass one URL from my internal network, that looks like this here:
http://<user><passwd><ipaddress>:<port>/cgi-bin/mjpg/video.cgi?channel=1&subtype=1
But this configuration always ends up in an error:
nginx: [emerg] invalid port in upstream "user:passwd#192.168.133.122:8080/cgi-bin/mjpg/video.cgi?channel=1&subtype=1" in /etc/nginx/sites-enabled/default:15
nginx: configuration file /etc/nginx/nginx.conf test failed
The only working way i get nginx to work is this one:
server {
listen 80;
root /var/www/html;
index index.php index.html index.htm;
location /video.cgi {
proxy_pass http://192.168.133.122:8080/cgi-bin/mjpg/video.cgi?channel=1&subtype=1;
}
}
But in this configuration the User and the Password are not included. Is there a way to get user&password also in the proxy_pass?
thanks
Franz

Configuring nginx to direct to website in server

I have a remote centOS server running locally on 127.0.0:8000 which I want to proxy with nginx.
I have tested that the server runs on that address and that nginx passes the tests.
When i try to access the ip on my browser I get:
I understand I need to edit the configuration files for nginx. I just don't know how.
I tried going to /etc/nginx/conf.d/index.conf (I named my app index because, reasons)
And I write the following:
server {
listen 80;
server_name www.<address>.com;
location / {
proxy_pass http://127.0.0.1:8000;
root /home/<user>/WebApp/templates;
index index.html;
}
}
And index.html is on the path I put on root. What am i doing wrong?

Why nginx virtual host is not available from internet?

I made a virtual host with nginx and I've add to host:
127.0.0.1 testapp
the virtual host http://testapp is available on my VPS but via from internet is not accessible:
server {
listen 80;
server_name testapp testapp.51.x.x.172;
##root html;
root c:/apps/web;
index index.html index.htm;
}
You have DNS problem.
You had to define a CNAME record on your host like testapp FQDN will be testapp.yourdomain.com and target host should be your yourdomain.com which is already registered A record.
In your host you should add this line.
127.0.0.1 testapp.yourdomain.com
your problem was finished
But you probably need to done a proxy revers on your web server.

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

Proxy .cfm to a CF server

I'd like to use Nginx as a proxy server for ColdFusion.
I'm forced to use ColdFusion 9. CF Developer Edition is installed using multiserver. The inbuit jrun server is running on port 8300 and I can access the admin panel at http://localhost:8300/CFIDE/administrator/index.cfm as described in the installer.
I have a hosts entry:
127.0.0.1 example.com
and the nginx config file is the following:
server {
listen 80;
server_name example.com;
root /home/user/dev/cf;
index index.cfm;
location ~ \.cfm$ {
proxy_pass http://127.0.0.1:8300;
}
}
There is a file /home/user/dev/cf/index.cfm with the following content:
<cfoutput>
<h1>Dupa</h1>
</cfoutput>
However, when I access http://example.com or http://example.com/index.cfm, I get a 404 error. The docroot also contains static files which are served normally, e.g. http://example.com/sitemap.xml.
Am I missing something? What should I do to proxy cfm files to the cf server?

Resources