login community 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:

1
2
3
4
5
6
7
8
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 Oct 16 '12 at 10:11

TwitTheKnife's gravatar image

TwitTheKnife
275


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:

1
2
set_real_ip_from   127.0.0.1;
real_ip_header     X-Forwarded-For;

answered Oct 16 '12 at 10:50

todork's gravatar image

todork
10964

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?

(Oct 16 '12 at 13:58) TwitTheKnife TwitTheKnife's gravatar image
1

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

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

Hope that helps!

(Oct 16 '12 at 16:10) seanf ♦♦ seanf's gravatar image
Your answer
If you have an answer to the above question, then use the form below. Otherwise, use the appropriate 'add new comment' button above to post your feedback.
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

Tags:

×127
×19
×17
×3

Asked: Oct 16 '12 at 10:11

Seen: 348 times

Last updated: Oct 16 '12 at 16:10

Plans & prices    Sign up    Why WebFaction?    Contact us    Affiliate program    Support    Legal    Jobs    Blog    Control panel login
Powered by OSQA
© Copyright 2003-2012 Swarma Limited - WebFaction is a service of Swarma Limited