Gentoo Archives: gentoo-user

From: "Poison BL." <poisonbl@×××××.com>
To: gentoo-user <gentoo-user@l.g.o>
Subject: Re: [gentoo-user] How to get nginx serving pages?
Date: Mon, 07 Nov 2016 17:17:15
Message-Id: CAOTuDKpYmh33v8m8wu1UyASckUYmVtBtVDndX0U8+NHLPxJWrw@mail.gmail.com
In Reply to: [gentoo-user] How to get nginx serving pages? by Peter Humphrey
1 On Mon, Nov 7, 2016 at 11:20 AM, Peter Humphrey <peter@××××××××××××.uk> wrote:
2 > Hello list,
3 >
4 > Several years ago I set up an apache2 web server to host a development site,
5 > and I had quite a struggle to get it all set up. Now I want to do it again,
6 > but I decided to try nginx instead. I've followed the instructions here:
7 >
8 > https://wiki.gentoo.org/wiki/Nginx
9 >
10 > ...but I get Connection Refused in www-client/links running on the same
11 > machine, or in Firefox over the LAN. I can run links as myself or as root,
12 > with the same result. But:
13 >
14 > $ curl http://localhost
15 > Hello, world!
16 >
17 > # netstat -tulpen | grep :80
18 > tcp 0 0 127.0.0.1:80 0.0.0.0:* LISTEN 0 60680 19196/nginx: master
19 >
20 > # cat /var/log/nginx/error_log
21 > 2016/11/07 16:06:19 [notice] 19195#0: using the "epoll" event method
22 > 2016/11/07 16:06:19 [notice] 19195#0: nginx/1.10.1
23 > 2016/11/07 16:06:19 [notice] 19195#0: OS: Linux 4.4.26-gentoo
24 > 2016/11/07 16:06:19 [notice] 19195#0: getrlimit(RLIMIT_NOFILE): 1024:4096
25 > 2016/11/07 16:06:19 [notice] 19196#0: start worker processes
26 > 2016/11/07 16:06:19 [notice] 19196#0: start worker process 19197
27 >
28 > /etc/nginx/nginx.conf is untouched since installation.
29 >
30 > Shorewall isn't logging anything.
31 >
32 > What have I overlooked?
33 >
34 > --
35 > Regards
36 > Peter
37 >
38 >
39
40 From the configuration in the aforementioned guide:
41
42 server {
43 listen 127.0.0.1;
44 server_name localhost;
45
46 access_log /var/log/nginx/localhost.access_log main;
47 error_log /var/log/nginx/localhost.error_log info;
48
49 root /var/www/localhost/htdocs;
50 }
51
52 This specifically instructs nginx to listen only on 127.0.0.1, so even
53 connections from the same machine to its hostname or external IP
54 address will not hit nginx there. You'll need to change the 'listen'
55 value to determine what connections it should be answering. See the
56 nginx documetation on that here:
57
58 http://nginx.org/en/docs/http/ngx_http_core_module.html#listen
59
60 I would suspect for your internal network use-case, you'll want:
61
62 listen *:80;
63
64 --
65 Poison [BLX]
66 Joshua M. Murphy

Replies

Subject Author
Re: [gentoo-user] How to get nginx serving pages? Peter Humphrey <peter@××××××××××××.uk>