WebFaction
Community site: login faq
0
1

I tried to configure my rails app to allow access from only one IP, but the result was that I couldn't access the website even from my IP. (I checked and double-checked my IP, using http://www.whatismyip.com/)

I modified the nginx config file such that:

http {
    # ...
    server {
        allow <my.ip.address>;
        deny all;
        # ...
    }
}

I likewise tried putting my allow/deny commands in the http block and in a location / {} block. Any guidance you can offer?

asked 16 Oct '12, 10:11

TwitTheKnife
27410
accept rate: 0%


Hi,

The problem is that your Nginx instance is running behind a proxy, so the IP it sees is always 127.0.0.1. To fix this, you would have to recompile Nginx with the --with-http_realip_module option (HttpRealipModule). You will then have to edit your Nginx configuration and fix the IP by adding the following:

set_real_ip_from   127.0.0.1;
real_ip_header     X-Forwarded-For;
permanent link

answered 16 Oct '12, 10:50

todork
1.2k4
accept rate: 34%

Thanks. I've never done anything like this, and I shouldn't like to omit any options currently enabled. Do you know a way to view all options currently enabled on nginx?

(16 Oct '12, 13:58) TwitTheKnife
1

You can see the configuration options on your current Nginx by running:

~/webapps/app_name/nginx/bin/nginx -V

Hope that helps!

(16 Oct '12, 16:10) seanf
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×186
×29
×23
×6

question asked: 16 Oct '12, 10:11

question was seen: 2,594 times

last updated: 16 Oct '12, 16:10

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM