Home > nginx > nginx proxy configuration error (config syntax)

nginx proxy configuration error (config syntax)

February 8Hits:1
Advertisement

Hihi,

below is the config + error it's throwing, can't for the life of me figure out what's wrong. Tried all sorts to get it working to no avail :(

server  {     listen  127.0.0.1:100;      access_log      /var/log/nginx/main.proxied.log;      location        ^~/(error_pages|javascript|stylesheets|help|images|xml|graphs|static|media) {     root    /usr/local/nagios/share;      location ~* \.(js|css|rdf|xml|ico|txt|gif|jpg|png|jpeg)$ {     root    /usr/local/nagios/share/; }  location / {      proxy_pass      http://127.0.0.1:80/;     proxy_redirect  off;      proxy_set_header        Host    $host;     proxy_set_header        X-Real-IP       $remote_addr;     proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;      client_max_body_size    10m; 

And the error;

Restarting nginx: [warn]: duplicate MIME type "text/html" in /etc/nginx/nginx.conf:29 [emerg]: location "/" is outside location "/(error_pages|javascript|stylesheets|help|images|xml|graphs|static|media)" in /etc/nginx/sites-enabled/main.conf:13 configuration file /etc/nginx/nginx.conf test failed 

Answers

You have mismatched curly brackets.

The line:

location        ^~/(error_pages|javascript|stylesheets|help|images|xml|graphs|static|media) {

Has an open-curly-bracket at the end of it but there is no closing curly bracket before the next location line.

What @memoryleak wrote is true also, if you close both of those location blocks, the existing close-curly-bracket will be closing the server block meaning the final location is now in the wrong context.

The final location block also has no closing curly-bracket.

In your configuration file location is outside of server directive, but the context of location is inside server: http://wiki.nginx.org/HttpCoreModule#location

Tags:proxy, nginx

Related Articles

  • nginx proxy configuration error (config syntax)February 8

    Hihi, below is the config + error it's throwing, can't for the life of me figure out what's wrong. Tried all sorts to get it working to no avail :( server { listen 127.0.0.1:100; access_log /var/log/nginx/main.proxied.log; location ^~/(error_pages|ja

  • NGINX proxy configurationSeptember 5

    I have a unicorn app server running a rails app and a tilestream server serving up tiles one listens on local unix socket, and the other on 127.0.0.1:8888 here is my conifg: upstream unicorn_server { server unix:/var/www/fulcrumapp/tmp/sockets/unicor

  • Is it possible to reduce this nginx proxy configuration?February 28

    I'm having an hard time trying to find out how to reduce this "repeated lines" for my NGinx configuration, just to change one property : server { #listen [::]:443 ipv6only=on; ## listen for ipv6 listen 443; server_name my.website.com; access_log

  • Nginx proxy configuration to hit the backend api via http proxyFebruary 11

    I need the Nginx web server to connect to a https server listening on port 443. The https server cannot be reached by Nginx server machine directly and to reach the https server the nginx server needs to set the http_proxy and https:proxy parameters.

  • Emulate nginx proxy configuration in apache with mod_proxy, how to?June 27

    I have a working configuration in nginx which is like this server { listen 80; server_name example.com; location / { proxy_pass http://127.0.0.1:8000; proxy_redirect default; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy

  • Dynamic variables from external source in nginx proxy configurationJune 18

    I need to do some conditional actions in nginx that is working as a proxy. Basically it all boils down to being able to set some nginx variable from external source. It can be a bash script or result generated by url or something like that. For examp

  • nginx proxy + ssl +clr "400 bad request" errorApril 23

    Here's the situation - there's a trasnparent nginx proxy that handles SSL certificates and does it well until we decide to add a revocation list management, required for security reasons. This is when the "ssl_crl" line comes in play and screws

  • docker nginx proxy: error ERR_TOO_MANY_REDIRECTSNovember 1

    I am using the jwilder/nginx-proxy docker container to proxy a magento container (using nginx) with SSL. I was able to set up the containers and run the magento installation routine with an SSL connection. After completing the installation I get a ER

  • ssl nginx proxy config for roundcubeJanuary 5

    I am running roundcube webmail over a nginx webserver that only serves http. This is proxied by another nginx which serves https. Both are separate FreeBSD jails on the same machine. I can basically access the roundcube webpage via the proxy's addres

  • configure: error: Cannot find php-config. Please use --with-php-config=PATHDecember 10

    I'm trying to install a program called phraseanet. I ran the ./configure command and run into this error: configure: error: Cannot find php-config. Please use --with-php-config=PATH I am using Ubuntu 10.04, Apache 2, PHP5 and Mysql 5 Does anyone know

  • NGINX Configuration Error using Codex Example: Is This a Typo in Codex?June 10

    I installed NGINX using this tutorial: C3M Digital NGINX Tuturial but after reading this article on security issues with "cut and paste" configuration tutorials: Neal Poole's article regarding security and NGINX configuration I decided to follow

  • configure: error: xml2-config not found. Please check your libxml2 installationDecember 24

    I am trying to install php5 to my fedora 14. But when I ./configure the error shows configure: error: xml2-config not found. Please check your libxml2 installation.. I installed libxml2 and when I run yum install libxml2 it says Package libxml2-2.7.7

  • apt-get update error using automatic proxy configurationJune 7

    I am using Ubuntu 10.4.04 LTS with in VMware5. I used automatic proxy configuration and I'm able to use internet from firefox. When I wanted to update apt-get update, I am getting following errors. The following link gives some solution, but I don't

  • How to configure nginx proxy to get only first the fastest response from the serversMarch 5

    Exist some remote servers with same static files http://site1.com/image.png http://site2.com/image.png http://site3.com/image.png For example, all this servers are unreliable and can give response only after few seconds. How can I configure my nginx

  • NGINX Proxy Pass to NodeJS App: Returning 502 errorSeptember 17

    I'm trying to setup NGINX as the frontend of my NodeJS app, which is live on 127.0.0.1:3000, but i can't resolve this 502 error. NGINX is locally reachable at http://55.55.55.5/ or http://dev.example dev.example (file in: /etc/nginx/sites-available a

  • Stop Nginx From Overwriting Proxied Server ErrorsJanuary 23

    I have a a server running behind an Nginx proxy. Sometimes this server returns 500 errors along with some useful information about those errors. Nginx seems to be swallowing the errors and returning it's own error page. How do I stop this? Nginx look

  • nginx proxy cache configuration for user authentication web applicationDecember 30

    I have a web application in node + express + passport + mongo database + ejs and single application is configured to handle all the sub-domains. I'm using nginx as proxy server, I need to and must use proxy cache as to reduce load on node server. I h

  • Apache2 configuration error: " VirtualHost was not closed" errorJune 28

    So I've already checked through my config file and I really can't see an instance where any tag hasn't been properly closed...but I keep getting this configuration error...Would you mind taking a look through the error and the config file below? Any

  • How to force Chrome to reload proxy configuration file?October 5

    I frequently move my laptop (OSX) between different wifi areas, but my home base has an ethernet connection and relies on my organisation's proxy.pac file. When reconnecting after a stint on the road, I often get a problem where pages simply don't lo

  • Forcing a particular SSL protocol for an nginx proxying serverOctober 10

    I am developing an application against a remote https web service. While developing I need to proxy requests from my local development server (running nginx on ubuntu) to the remote https web server. Here is the relevant nginx config: server { server

Copyright (C) 2017 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 14 q. 0.714 s.