Skip to content

Commit ce392b9

Browse files
committed
wordpress: Fix PHP error log noise from internal files
Avoid noise in PHP error logs from bots crawling WP internals > Uncaught Error: Call to undefined function __() > in /srv/wordpress/sites/jquery_com/wp-admin/includes/file.php https://core.trac.wordpress.org/ticket/9185
1 parent a84d687 commit ce392b9

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

modules/profile/manifests/wordpress/docs.pp

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@
137137

138138
file { "${dir}/wp-content/object-cache.php":
139139
ensure => file,
140-
source => "file:///srv/wordpress/jquery-wp-content/plugins/memcached/object-cache.php",
140+
source => 'file:///srv/wordpress/jquery-wp-content/plugins/memcached/object-cache.php',
141141
require => [
142142
Exec["wp-download-${name}"],
143143
Package['memcached']

modules/wordpress/templates/site/site.nginx.erb

+15
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,21 @@ server {
2222
deny all;
2323
}
2424

25+
# Avoid noise in PHP error logs from bots accessing includes
26+
#
27+
# > Uncaught Error: Call to undefined function __()
28+
# > in /srv/wordpress/sites/jquery_com/wp-admin/includes/file.php
29+
#
30+
# https://core.trac.wordpress.org/ticket/9185
31+
location ^~ /wp-includes/(.*).php {
32+
access_log off;
33+
deny all;
34+
}
35+
location ^~ /wp-admin/includes/ {
36+
access_log off;
37+
deny all;
38+
}
39+
2540
include /etc/nginx/wordpress-subsites/<%= @host %>.d/*.conf;
2641

2742
<%- if @gilded_wordpress -%>

0 commit comments

Comments
 (0)