Skip to content

Commit

Permalink
Merge branch '123.08centos7beta02wp' into 123.08centos7beta02
Browse files Browse the repository at this point in the history
  • Loading branch information
centminmod committed Apr 8, 2015
2 parents 8870e67 + 5e02123 commit 5f05a90
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions config/nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ events {
}

http {
limit_req_zone $binary_remote_addr zone=xwplogin:16m rate=40r/m;

more_set_headers "Server: nginx centminmod";

include /usr/local/nginx/conf/geoip.conf;
Expand Down
13 changes: 13 additions & 0 deletions inc/wpsetup.inc
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,14 @@ fi
chown -R nginx:nginx "/home/nginx/domains/$vhostname"
find "/home/nginx/domains/$vhostname" -type d -exec chmod g+s {} \;

# rate limit setup

WPRATECHECK=$(grep 'zone=xwplogin' /usr/local/nginx/conf/nginx.conf)

if [[ -z "$WPRATECHECK" ]]; then
sed -i 's/http {/http { \nlimit_req_zone $binary_remote_addr zone=xwplogin:16m rate=40r/m;\n/g' /usr/local/nginx/conf/nginx.conf
fi

# Setting up Nginx vhost mapping for Wordpress
cat > "/usr/local/nginx/conf/conf.d/$vhostname.conf" <<END
# Centmin Mod Getting Started Guide
Expand Down Expand Up @@ -127,6 +135,11 @@ try_files /wp-content/cache/supercache/\$http_host/\$cache_uri/index.html \$uri

}

location ~* /(wp-login\.php) {
limit_req zone=wplogin burst=1 nodelay;
include /usr/local/nginx/conf/php.conf;
}

include /usr/local/nginx/conf/wpsecure_${vhostname}.conf;
include /usr/local/nginx/conf/php.conf;
include /usr/local/nginx/conf/staticfiles.conf;
Expand Down

0 comments on commit 5f05a90

Please sign in to comment.