Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Help for my first steps with nginx as a proxy
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Whitewolf Fox
Tux's lil' helper
Tux's lil' helper


Joined: 29 Aug 2004
Posts: 78
Location: Ratingen

PostPosted: Mon May 26, 2014 9:03 pm    Post subject: Help for my first steps with nginx as a proxy Reply with quote

Hi everyone,

I'm just starting with nginx. I know, there are many tutorials out there, but I just do not find this kind of issue or even the single steps explained well enough to make me understand why this setup is not working:

I configured a server, listening on 8080 with two location blocks in there:

Code:

server {
        listen 85.25.153.14:8080;
        server_name move.marc-richter.info;
        keepalive_timeout 60;
        access_log /var/log/nginx/move.marc-richter.info-8080_access.log combined;
        error_log /var/log/nginx/move.marc-richter.info-8080_error.log info;
        root /var/www/localhost/htdocs;

        location / {
        }

        location /test {
                root /var/www/localhost/htdocs2;
        }

        location = /favicon.ico {
          return 204;
          access_log     off;
          log_not_found  off;
        }
}


The third location block is just in there to quieten my logs in case of not found favicon.ico file.

As far as I understand nginx config, this should do the following:


  1. Serving index.html from /var/www/localhost/htdocs/index.html when someone opens move.marc-richter.info:8080.
  2. Serving index.html from /var/www/localhost/htdocs2/index.html when someone opens move.marc-richter.info:8080/test.


The first one is working OK. But with the second one, I get 404 shown and the following is written to the logs:

Code:
==> move.marc-richter.info-8080_error.log <==
2014/05/26 22:48:15 [info] 882#0: *6 client 80.187.106.136 closed keepalive connection
2014/05/26 22:48:27 [error] 882#0: *7 open() "/var/www/localhost/htdocs2/test" failed (2: No such file or directory), client: 80.187.106.136, server: move.marc-richter.info, request: "GET /test HTTP/1.1", host: "move.marc-richter.info:8080"

==> move.marc-richter.info-8080_access.log <==
80.187.106.136 - - [26/May/2014:22:48:27 +0200] "GET /test HTTP/1.1" 404 162 "-" "Opera/9.80 (Windows NT 6.1; WOW64) Presto/2.12.388 Version/12.17"


I do not get why the location's path is appended to the document root here (/var/www/localhost/htdocs2/test) and do expect that connections to the location /test are served from within /var/www/localhost/htdocs2 directly. Could someone please explain what I am doing wrong?

I do have more questions, since this is the very first step. But I think it's worth to understand this one first and retry to think about the other points once I have understood this.
_________________
http://www.marc-richter.info
Back to top
View user's profile Send private message
Whitewolf Fox
Tux's lil' helper
Tux's lil' helper


Joined: 29 Aug 2004
Posts: 78
Location: Ratingen

PostPosted: Tue May 27, 2014 3:11 pm    Post subject: Reply with quote

noone?
_________________
http://www.marc-richter.info
Back to top
View user's profile Send private message
VBart
n00b
n00b


Joined: 27 May 2014
Posts: 1

PostPosted: Tue May 27, 2014 9:11 pm    Post subject: Reply with quote

You've spent more time in asking this question, instead of just read the docs: http://nginx.org/r/root
Quote:
A path to the file is constructed by merely adding a URI to the value of the root directive.
Back to top
View user's profile Send private message
Whitewolf Fox
Tux's lil' helper
Tux's lil' helper


Joined: 29 Aug 2004
Posts: 78
Location: Ratingen

PostPosted: Wed May 28, 2014 7:20 am    Post subject: Reply with quote

Sorry, I realized that I have asked unclear.
I'm aware why /test is appended to my root.
What I do not understand is the use of this behavior and how to achieve what I'm trying to do with it: I'd like to configure something, which acts like the Apache's aliases. For example, I'd like to achieve with nginx what this apache config does:

Code:

DocumentRoot /var/www/localhost/htdocs/
ServerName      move.marc-richter.info

<Directory "/var/www/localhost/htdocs/">
        Options -Indexes -ExecCGI FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
</Directory>

Alias /test/   "/var/www/localhost/htdocs2/"
Alias /test    "/var/www/localhost/htdocs2/"

<Directory /var/www/localhost/htdocs2/>
        Options -Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
</Directory>


Accessing move.marc-richter.info/test would now serve an index document from /var/www/localhost/htdocs2/ , not append /test to /var/www/localhost/htdocs2/test . I thought location is nginx's answer to this - can you tell me how to do it instead of this directive?
_________________
http://www.marc-richter.info
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum