Quantcast
Channel: Nginx Forum - Other discussion
Viewing all articles
Browse latest Browse all 972

nginx load balancer config? - help! :)

$
0
0
Hi! I'm new to NGINX and I would like to setup a load balancer for our web server. this is what my /etc/nginx/sites-available/default looks like

upstream server {
server 192.168.1.101;
server 192.168.1.102;
}
server {
listen 80;
location / {
proxy_set_header X*Forwarded*For $proxy_add_x_forwarded_for;
proxy_pass http://server;
}
}

but if i run (nginx -t), i get this error -

nginx: [emerg] unknown directive "upstream server" in /etc/nginx/sites-enabled/default:1
nginx: configuration file /etc/nginx/nginx.conf test failed

searched the internet and they fix this kind of issue by adding it to the http {} or adding this line in the nginx.conf file - include /etc/nginx/sites-enabled/*;
I have tried several solution found on the internet and still got this error. I even created a new VM for a fresh setup, still the same. BTW, i was following this example - https://www.youtube.com/watch?v=SpL_hJNUNEI

Inputs will be greatly appreciated. Thank you!

Viewing all articles
Browse latest Browse all 972

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>