← All articles How to Harden WordPress Server Settings Step by Step How-to

How to Harden WordPress Server Settings Step by Step

Last Updated: November 5, 2026

Quick Summary

To harden WordPress server settings, set directories to 755 and files to 644 so only the owner can change code, and restrict wp-config.php to 600 or 640. Keep it out of public reach, block PHP execution in the uploads folder, and add security headers. Test each change on staging first and confirm the site still works.

  • Set directories to 755 and files to 644 so only the owner can change them.
  • Keep wp-config.php at 600 or 640, per common advice.
  • Block PHP execution in the uploads folder so disguised PHP files cannot run.
  • Test every server change on staging and back up the original file first.
  • Verify each change afterwards by checking the site, forms, admin area and logs.

Table of Contents

Setting WordPress File Permissions and Ownership

Correct file permissions are one of the simplest ways to harden a WordPress server. They control who can read, write and run each file; when too open, an attacker who gets into one part of the site can change code that runs everywhere else.

Business owner reviewing server settings to harden WordPress server while working at a bright desk in an office.
Business owner reviewing server settings to harden WordPress server while working at a bright desk in an office.

A common starting point is directories at 755 and files at 644, so the web server reads and runs code but only the owner can change it. Many guides also advise keeping wp-config.php at 600 or 640.

Check exact values with your host first, some setups need different settings, and wrong permissions can stop the site loading. Read a comparison of managing permissions yourself versus a maintenance service to decide which suits you. If you would rather not work through these settings alone, WP Clinic's WordPress Security & Maintenance Essentials plan covers ongoing checks of this kind.

The article's main permission settings are summarised below.

Item Value Note
Directories 755 Web server reads and runs; only owner changes
Files 644 Readable by the web server, writable only by owner
wp-config.php 600 or 640 Common advice for restricting access
Exact values Check with host Some setups need different settings

Securing wp-config.php and Disabling PHP Execution in Uploads

wp-config.php holds your database credentials and security keys. Keep it out of public reach, ensure the web server never serves it as plain text, and move it one level above the web root where your host supports this. Compare hardening these settings yourself with a security plugin to see which approach suits your site.

The uploads folder is a frequent target, where attackers upload a PHP file disguised as an image. Blocking PHP execution there stops such a file running even if it gets through.

Wordpress Support Plans →

A mistake in the server rules can take the whole site offline, so test every change on staging first and back up the original file.

Adding WordPress Security Headers and Verifying Your Changes

HTTP security headers tell browsers how to handle your pages. Useful ones include X-Content-Type-Options, X-Frame-Options and a Content-Security-Policy; add them in your server configuration, then check with a header-testing tool. Consistent headers also help protect checkout pages, making them one part of securing your store.

After every change, confirm the site loads, forms send and the admin area works, and review server logs for unusual errors. Hardening is only useful if you check it took effect, so after you harden WordPress server settings, verify each change.

For a full review of your setup, you can also request a WordPress Website Audit Report from our team.

Frequently Asked Questions

How do I harden WordPress server settings?

Start by setting directory permissions to 755 and file permissions to 644, confirm the web server user owns the files, and keep wp-config.php read-only. Next, disable PHP execution in the uploads folder, add security headers in your server configuration, and restrict or disable XML-RPC if you do not use it. Test each change on a staging copy first, then check the live site loads correctly and review your server logs for errors. Keep a backup before you start so you can roll back any setting that causes a problem.

What file permissions should WordPress use?

Most WordPress installations work well with directories set to 755 and files set to 644. The wp-config.php file can usually be tightened to 600 or 640, depending on how your host runs PHP. Avoid 777 on any file or folder, as it allows anyone on the server to change content. If a setting breaks uploads or updates, reset the affected folder to 755 and check the owner and group rather than loosening permissions across the whole site.

Can I disable PHP execution in the uploads folder?

Yes. Placing a rule in the wp-content/uploads directory that stops PHP files from running reduces the risk of an attacker uploading and executing a malicious script. On Apache this is usually done with a .htaccess rule, and on Nginx with a location block. Because this affects how the server handles requests, test image uploads and media display after the change to confirm nothing essential has been blocked.

GoogleAdd wpclinic.com.au as a preferred source on Google →