0

I think I'm chasing my own tail here and I've decided to ask all you gurus.

I have two machines, one has a reverse proxy Nginx and the other an Apache running several virtual hosts.

The nginx correctly does the proxy_pass and I'm able to view the index.html, but not any other file than that.

I attach the conf file for the nginx host (nbte.com.br, (192.168.4.30)) and the apache virtual host (SIPREPWWPRESS03.simosa.inet)

NGINX - 083-nbte.conf

server {

listen       80;
server_name  nbte.com.br www.nbte.com.br;

access_log  /var/log/nginx/nbte.access.log;
error_log   /var/log/nginx/nbte.error.log error;

error_page   404 403           /handle404.html;
#error_page   502 503 504  /handle503.html;
error_page   500 502 503 504   /handle500.html;

location = /handle404.html {
     root html/errores-prxy;
}

location = /handle503.html {
     root html/errores-prxy;
}

location = /handle500.html {
     root html/errores-prxy;
}

location = / {
    proxy_pass http://SIPREPWWPRESS03.simosa.inet/;
}

SIPREPWWPRESS03.simosa.inet resolves to 192.168.16.79

APACHE - 021-nbte.conf

<VirtualHost 192.168.16.79:80>

    ServerName    nbte.com.br
    ServerAlias   nbte.com.br www.nbte.com.br

    DocumentRoot "/apps/htmlsites/nbte"

    ErrorLog "logs/error_nbte.log"
    CustomLog "logs/nbte-access.log" combined

    <LocationMatch "/*">

    </LocationMatch>

    <Directory "/apps/htmlsites/nbte">
            Options +Indexes FollowSymLinks
            #AllowOverride AuthConfig FileInfo
            Order allow,deny
            Allow from all
    </Directory>


    # ModSecurity exceptions
    <LocationMatch "/*">
            SecRuleRemoveById 990011
            SecRuleRemoveById 960017
            SecRuleRemoveById 960015
            SecRuleRemoveById 970013
    </LocationMatch>

I've almost no experience with NGINX, I'm very very new to it and specially it's reverse proxy functioning. Nevertheless, I think it's a NGINX issue, since looking at the error log file I find error lines each time a static file is requested:

2015/06/25 12:00:04 [error] 5075#0: *1393 open() "/etc/nginx/html/Informacoes-Financeiras-30-junho-2014-Norte-Brasil-Transmissora-Energia.pdf" failed (2: No such file or directory), client: 192.168.14.1, server: nbte.com.br, request: "GET /Informacoes-Financeiras-30-junho-2014-Norte-Brasil-Transmissora-Energia.pdf HTTP/1.1", host: "nbte.com.br", referrer: "http://nbte.com.br/"


2015/06/25 12:00:04 [error] 5075#0: *1393 open() "/etc/nginx/html/Informacoes-Financeiras-30-junho-2014-Norte-Brasil-Transmissora-Energia.pdf" failed (2: No such file or directory), client: 192.168.14.1, server: nbte.com.br, request: "GET /Informacoes-Financeiras-30-junho-2014-Norte-Brasil-Transmissora-Energia.pdf HTTP/1.1", host: "nbte.com.br", referrer: "http://nbte.com.br/"

The file Informacoes-Financeiras-30-junho-2014-Norte-Brasil-Transmissora-Energia.pdf is located inside Apache's document root /apps/htmlsites/nbte alog with index.html

Many thanks in advance. Any help is really appreciated.

0

This

location = / {
proxy_pass http://SIPREPWWPRESS03.simosa.inet/;
}

Should be

location / {
proxy_pass http://SIPREPWWPRESS03.simosa.inet/;
}

As per http://wiki.nginx.org/HttpCoreModule#location

location = / {
# matches the query / only.
[ configuration A ]
}

location / {
# matches any query, since all queries begin with /, but regular
# expressions and any longer conventional blocks will be
# matched first.
[ configuration B ]

Example requests:

/ -> configuration A
/index.html -> configuration B

  • Indeed this was the reason :-) I changed it and now it's serving all the statics from the Apache. Thank you for your time and your solution! Best regards! – lgg Jun 25 '15 at 11:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.