Setting up mongodb behind nginx - nginx

I am trying to setup mongodb behind nginx, and below is the configuration I used. But I keep getting the following error when I reload nginx. Any help is appreciated.
nginx: [emerg] no port in upstream "stream_mondo_backend" in /etc/nginx/nginx.conf:15

You have a trivial mistype. stream_monGo_backend in upstream section and stream_monDo_backend in proxy_pass directive.

Related

Setting up Jenkins with Nginx reverse proxy

I have a Jenkins environment setup, running off a EC2 instance and trying to get port 80 mapped to port 8080.
A suggestion made (and the way most of the configurations I've seen recommended) uses Nginx to do a reverse proxy.
I have installed Nginx on the server, and added to sites-available the following:
server {
listen 80;
server_name jenkins.acue.io;
location / {
include /etc/nginx/proxy_params;
proxy_pass http://localhost:8080;
proxy_read_timeout 60s;
# Fix the "It appears that your reverse proxy set up is broken" error.
# Make sure the domain name is correct
proxy_redirect http://localhost:8080 https://jenkins.acue.io;
}
}
I hit the IP address of the jenkins environment, it shows me the Ngnix welcome screen and Jenkins still loads against port 8080 not port 80.
Do I need to specific the current URL (I've not pointed the jenkins.acue.io sub-domain yet to the EC2 instance where I have specified localhost? I've tried it but no joy).
Few things to note.
You need to add jenkins.acue.io to your Host entries and point it to the instance where you are running NginX. Then use the FQDN to access Jenkins. Also there is a typo in your proxy_redirect where you have added https URL instead of http://jenkins.acue.io fix that as well. Other than that your NginX configurations look fine.
If you keep on getting the NginX welcome page even though you are accessing through the FQDN, that means your configurations are not being picked up by NginX. Try creating a new file like jenkins.conf and add it to /etc/nginx/conf.d. Then do a sudo systemctl restart nginx

Nginx+Gunicorn - reverse proxy not working

I am trying to setup a python flask application on a server following this guide: https://www.digitalocean.com/community/tutorials/how-to-serve-flask-applications-with-gunicorn-and-nginx-on-ubuntu-18-04. I have this working running on my local machine by following the guide. However when I am trying to implement on the actual server with the same config I am running into an issue on proxying requests back to the gunicorn server. I am able to serve static content from Nginx with no problem. When I make a web service call from the static content back to Nginx, it should be proxied back to the gunicorn server.
For example when I try to make the call 'http://example.com/rest/webService', I would expect Nginx to pass anything starting with /rest/ back to gunicorn. The error below is all I can see in the error logs about what is happening:
2019/01/18 12:48:18 [error] 2930#2930: *18 open() "/var/www/html/rest/webService" failed (2: No such file or directory), client: ip_address, server: example.com, request: "GET /rest/webService HTTP/1.1", host: "example.com", referrer: "http://example.com/"
Here is the setup for python_app:
server {
listen 80;
server_name example.com www.example.com;
root /var/www/html;
index index.html;
location ^/rest/(.*)$ {
include proxy_params;
proxy_pass http://unix:/home/username/python_app/python_app.sock;
} }
The only change to my nginx.conf file was to change 'include /etc/nginx/sites-enabled/*' to 'include /etc/nginx/sites-enabled/python_app'.
Please let me know if you have any ideas at all on what I may be missing! Thanks!
Not a solution, but some questions....
If you run
sudo systemctl status myproject
Do you see affirmation that gunicorn is running, and what socket it is bound to?
And does
sudo nginx -t
come back saying no diagnostic?
The regex in the location block for nginx -- I don't see anything similar to that in the guide, I see that you're trying to capture everything after "rest/", but looking at the nginx documents, I think you'd have to have $1 to reference the captured part of the URL. Can you try without the "^/rest/(.*)$" and see whether nginx finds anything?
Is the group that owns your directory a group that nginx is part of (a lot of setups are www-data)

Nginx unknown directive "proxy_pass"

I'm having a problem with nginx configuration.
When I set the configuration like this:
server {
server_name redmine;
listen 80;
location / {
proxy_pass http://172.16.0.70:33000;
}
}
I get this error nginx: [emerg] unknown directive "proxy_pass".
My nginx version is nginx/1.8.0.
Someone know what i'm missing or what i'm doing wrong? Thanks.
Seems that module ngx_http_proxy_module is not installed
Run nginx -V to view how nginx is configured. If it is configured with option --without-http_proxy_module than nginx doesn't have proxy module and should be recompiled.

Nginx and upstream : configuration failed

I try to test load balancer with nginx so I add upstream like the documentation exemple. But when I try to reload nginx to refresh the configuration, the refresh fail.
I just added upstream bloc, if I remove it all work
file : /etc/nginx/sites-available/default
upstream backend {
server webserver1:80;
server webserver2:80;
}
server {
listen 80;
listen [::]:80;
server_name www.interceptlocalcall.io interceptlocalcall.io;
location /users {
proxy_pass http://127.0.0.10:18000;
}
...
when I reload with the upstream block :
[FAIL] Reloading nginx configuration: nginx failed!
Nginx version :
nginx version: nginx/1.6.2
I see anything about this error, so I think I just miss something, perhaps in the install ?
If you have any idea thanks.
Please test your configuration by running $ nginx -c /etc/nginx/nginx.conf -t — it will tell you more detailed information about what's wrong with your configuration.
These messages also written to global error.log file (not one you define for servers but one defined in http section), usually located in /var/log/nginx/error.log.

limit_conn_zone Nginx Unknow error

What am I doing wrong here?
http {
limit_conn_zone $binary_remote_addr zone=one:63m;
server {
location /downloads/ {
limit_conn one 10;}
[root#batman1 ~]# service nginx configtest
nginx: [emerg] the size 66060288 of shared memory zone "one" conflicts with already declared size 0 in /etc/nginx/nginx.conf:60
nginx: configuration file /etc/nginx/nginx.conf test failed
Thx!
I resolve my miss configuration.
Only changing of position my include to the final.
On nginx.conf I put the directive limit_conn_zone after the include.
and that cause the error.
Moving the include directive is all solve.

Categories

Resources