TODO: To change the header's content go to Dr.Explain menu Options : Project Settings : HTML (CHM) Export : Setup HTML Template and Layout
×
Menu
Index

Bảo mật wordpress

 
Wordpress là mã nguồn mở, do vậy có nhiều người biết về code do vậy bạn cần thiết có kiến thức để bảo mật wordpress. Tuy nhiên wordpress hiện nay chiếm tới 50-60% website trên internet con số này bạn cũng hiểu về sự tự tin của mã nguồn này.
 
Có nhiều cách để bảo mật wordpress, Những cách sau đây sẽ giúp bạn bảo vệ website wordpress của mình khỏi sự tấn công của hacker.
Cài đặt:
- Đổi tên tài khoản quản trị, đừng dùng user 'admin' và hãy chọn một mật khẩu có độ mạnh cao.
- Đổi tiền tố bảng database, không dùng mặc định là 'wp_' , để thực hiện trước khi cài đặt wordpress bạn mở cấu hình wp-config.php thay đổi giá trị ở biến $table_prefix.
- Luôn cập nhật phiên bản wordpress mới nhất.
 
Plugins:
- Điều đầu tiên nghĩ tới là hãy chắc chắn các plugins được cập nhật phiên bản mới nhất.  Những plugins không sử dụng thì xóa chúng đi.
 
Firewall:
- Cài đặt plugins để thiết lập bức tường lửa cho wordpress:
+ iThemes Security (https://wordpress.org/plugins/better-wp-security/)
+ All In One WP Security & Firewall (https://wordpress.org/plugins/all-in-one-wp-security-and-firewall/)
 
Bảo mật wp-includes:
Sử dụng htaccess để bảo mật quyền truy cập thư mục wp-includes. Thêm bên ngoài cặp # BEGIN và # END để tránh bị ghi đè bởi wordpress.
# Block the include-only files.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^wp-admin/includes/ - [F,L]
RewriteRule !^wp-includes/ - [S=3]
RewriteRule ^wp-includes/[^/]+\.php$ - [F,L]
RewriteRule ^wp-includes/js/tinymce/langs/.+\.php - [F,L]
RewriteRule ^wp-includes/theme-compat/ - [F,L]
</IfModule>
 
Chú ý rằng đoạn code này không làm việc tốt nếu bạn kích hoạt tính năng multisite.
 
Bảo mật wp-config.php
Sử dụng file .htaccess, đặt đoạn code sau ở đầu file để không cho người khác đánh cắp file cấu hình wp-config.php
<files wp-config.php>
order allow,deny
deny from all
</files>
 
Bảo vệ file .htaccess
Bạn nên bảo vệ chính file .htaccess với dòng lệnh sau. Thêm vào .htaccess
<Files .htaccess>
   order allow,deny
   deny from all
</Files>
 
Tắt tính năng sửa file trong trang quản trị.
Wordpress có sử dụng hằng để bật/tắt chế độ sửa file trong wordpress dashboard. Thêm vào file wp-config.php dòng lệnh sau để vô hiệu hóa quyền  'edit_themes', 'edit_plugins' and 'edit_files' cho toàn bộ users.
define('DISALLOW_FILE_EDIT', true);
 
Tạo Mã bí mật:
Hãy chắc chắn bạn thay đổi secret keys trong file wp-config.php
 
Hướng dẫn: Truy cập https://api.wordpress.org/secret-key/1.1/salt/ và lấy mã bí mật ngẫu nhiên của bạn.
 
Ẩn phiên bản Wordpress.
Đặt đoạn code sau vào theme functions.php
remove_action('wp_head', 'wp_generator');
 
Bạn cũng nên xóa nó trong RSS feeds.
function wpt_remove_version() {
   return '';
}
add_filter('the_generator', 'wpt_remove_version');
 
Giới hạn số lần cố gắng đăng nhập nhưng thất bại.
Made with help of Dr.Explain

Unregistered version