Nginx, Passenger, and Rails are running beautifully on my Linode. Before I launch, I'd like to restrict access so only my IP can view the site.
I've tried to deny access to all, and allow access to only my IP in Nginx. It does deny access to all, but I can't get the allow to work. I have checked to ensure the IP address I'm specifying in nginx.conf is my correct public ip.
Here's my nginx.conf. I've restarted nginx after editing the file, and tested some other changes which worked as expected (for instance, I removed deny all and was able to access the site, as expected).
What am I doing wrong?
http { passenger_root /path/to/passenger-3.0.11; passenger_ruby /path/to/ruby; include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; gzip on; server { listen 80; server_name www.foo.bar; root /path/to/rails/public/; passenger_enabled on; location / { allow my.public.ip.here; deny all; } } }
To limit connections, use the limint_conn directive to set the memory zone to be used and the maximum number of allowed connections as shown in the following configuration snippet. This directive is valid within the HTTP, server, and location contexts. Save the file and close it.
modify your nginx.conf
server { listen 80; server_name www.foo.bar; location / { root /path/to/rails/public/; passenger_enabled on; allow my.public.ip.here; deny all; } }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With