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.
Related
Today, I installed mod_security for nginx. I added the following block to
server {
listen 80;
server_name mydomain.com;
modsecurity on;
modsecurity_rules_file /etc/nginx/modsec/main.conf;
location / {
proxy_pass http://10.0.1.54:8002;
}
After restarting Nginx, I got the following error:
nginx: [emerg] "try_files" directive Rule id: 254 is duplicated
in /etc/nginx/nginx.conf:62
nginx: configuration file /etc/nginx/nginx.conf test failed
What is going wrong? how to fix it?
This guide installed is here: https://www.tecmint.com/install-modsecurity-nginx-debian-ubuntu/
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
My puprose is to use nginx as a proxy for another application and I get an error above and I get 502 badgateway when I try to access my app.
My nginx configurations are shown below and I already unlinked the default nginx configurations but I still get the error below in /var/log/nginx/error.log.
Any clues ?
server{
listen 80 default_server ;
listen [::]:80 default_server;
server_name pivot.staging.ippen.space;
location / {
resolver 127.0.0.53
proxy_pass https://$server_name:443/;
}
}
and when i used 127.0.0.1 / 8.8.8.8 as a resolver I get the folowing error:
nginx: [emerg] host not found in resolver "proxy_pass" in /etc/nginx/sites-enabled/custom_server.conf:9
I use nginx as a VM instance on Google cloud and I have two firewall rules (allow http and allow ssh access); OS is ubuntu 16.04.
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.
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.