Welcome! Log In Create A New Profile

Advanced

Securing WordPress with NginX Behind AWS ELB?

Posted by autolux 
Securing WordPress with NginX Behind AWS ELB?
March 24, 2015 11:35PM
Hi all,

Have recently moved my WP based website under NginX behind an Amazon ELB. Whilst IP restriction to wp-admin & wp-login was previously working, I'm now having issue restricting to my IP's only, due to the X-Forwarded-For of the load balancer.

I've tried so many options but I can't seem to find a working example for being behind a load balancer.

Any ideas?

Below are some of the variations in my nginx site.conf. The closest I can do is geting it to restrict the IP correctly unless it's in my allow IP's list, but if it is, instead of parsing wp-admin or wp-login normally in browser, it just prompts me to download the file... examples i've tried:

-----
location ~* ^/(wp-admin|wp-login) {
allow <my-ip>;
deny all;
}
----
Deny access to admin pages
location ~ ^/(wp-admin|wp-login\.php) {
set $allow false;
if ( $remote_addr ~ <my-ip> ) {
set $allow true;
}
if ($allow = false) {
return 403;
}
}
-----
location ~ ^/(wp-admin|wp-login\.php) {
set $allow false;
if ( $http_x_forwarded_for ~ ^my.\ip\ ) {
set $allow true;
}
if ($allow = false) {
return 403;
}
}
-----
if ( $http_x_forwarded_for != ^my\.ip\. && location ~ "^/wp-admin\.php" ) {
error 404 "Not the droids you are looking for...";
}

-----

I'm at a loss, if anyone has this working in full could you please let me know what is required in configuring NginX for this situation?
Re: Securing WordPress with NginX Behind AWS ELB?
May 08, 2015 07:33AM
Hi,

We have six Wordpress site running on ngnix. We are facing Wordpress Admin Css Distorted problem due load-scripts.php is not loading from last 5 Months.We have tried some solutions but nothing to work. The frequency of this issue is Between: 3-7 days. The solution of this issues is restart the server which is not permanent solution.

ciol.com
dqweek.com
dqchannels.com
dqindia.com
voicendata.com
pcquest.com

If anyone can help us on this??
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 283
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready