Software a open source

Průvodce zabezpečením Joomla: Jak chránit váš web krok za krokem

Joomla Security Guide: How to Protect Your Website Step by Step

Zabezpečte svůj Joomla web praktickými návodem na MFA, ACL, .htaccess, .htpasswd a zálohování Akeeba. Postupujte podle osvědčených kroků pro zpevnění přístupu správce a hostingu.

Bezpečnostní průvodce Joomla: Jak chránit své webové stránky krok za krokem

A Joomla website can be fully updated and still be exposed through a stolen administrator password, an abandoned extension, or insecure hosting. Effective security requires several layers: maintain the software, restrict privileges, protect administrator access, harden Apache, and prepare a tested recovery plan.

This tutorial provides practical instructions for Joomla administrators, including Apache configuration examples. Before editing production configuration, make a full backup and ensure you have SFTP or file-manager access to reverse a broken .htaccess rule.

1. Auditujte svou instalaci Joomla

Open the administrator dashboard at https://example.com/administrator. Record your Joomla version, PHP version, available extension updates, accounts with Super User privileges, MFA configuration, and the date of your last verified backup.

For a small business site, an owner, two content editors and an occasional contractor should not all have permanent Super User access. Give each person only the permissions required for their work.

Prioritize urgent patches, MFA and a restorable backup before experimenting with server rules. Check the Joomla Security Centre for advisories.

2. Aktualizujte Joomla a rozšíření bezpečně

Open System → Update → Joomla and review the available version. Back up the files and database, check extension compatibility, and test major changes on staging. After applying an update, verify the frontend, administrator login, contact forms, payment functionality and scheduled jobs.

Check System → Update → Extensions as well. Some extensions lack working update feeds: review their vendors' websites separately. Remove unused or unsupported extensions rather than assuming that disabling them eliminates vulnerable code.

Verification: record the installed versions and test the site's critical functions after every update.

3. Povolte vícifaktorovou autentifikaci

MFA reduces the risk that a stolen password alone can grant administrative access.

  1. Confirm the necessary MFA plugins are enabled under System → Plugins.
  2. Sign in to your administrator account and open Edit Account.
  3. Find Multi-factor Authentication and register an authenticator application or another supported method.
  4. Confirm the generated verification code and store recovery codes securely.
  5. In Users → Manage → Options, review the option to enforce MFA for privileged user groups.

Verification: log out and sign in again in a private browser window. Check that the additional factor is required. Prepare a secure recovery procedure before enforcing MFA for everyone.

Joomla also supports WebAuthn authentication. Passwordless WebAuthn login and MFA enforcement are distinct features: enabling one does not necessarily secure every alternative login path. See the official WebAuthn guide.

4. Omezte přístup s Joomla ACL

Open Users → Manage and review accounts and groups. Assign content editors only the rights they need, rather than Super User permissions. For a contributor who should draft articles but not publish them, use an appropriate authoring group and review permissions on the relevant categories under Content → Categories.

Test using a separate account. Confirm the contributor can write in the intended category but cannot publish, install extensions, modify global configuration or manage users. Hiding a menu item is not an access-control mechanism.

For details, see the Joomla ACL documentation.

5. Začněte s hardeningem Apache s Joomla's htaccess.txt

If your host runs Apache and permits .htaccess overrides, Joomla provides a htaccess.txt file at the website root. Review it, make a backup, and rename it to .htaccess if you want to use its rewrite and protection rules. If an existing .htaccess file is present, merge the required directives carefully rather than overwriting it.

On Nginx, .htaccess files are ignored; configure equivalent restrictions in the Nginx server configuration. Apache directives may also be unavailable on managed hosting.

One useful directive prevents directory listings:

Options -Indexes

If Apache reports an internal server error, check whether your hosting configuration permits that directive. Remove or correct the rule using SFTP or the file manager.

You can deny web access to sensitive files:

<FilesMatch "^(?:configuration\.php|\.env|composer\.(?:json|lock))$">
    Require all denied
</FilesMatch>

<FilesMatch "\.(?:sql|bak|backup)$">
    Require all denied
</FilesMatch>
Illustration of the article's main concept

These examples assume Apache 2.4. They do not replace storing backups and secrets outside the public document root. Test them on your actual server; avoid broad rules that interfere with Joomla extensions.

Verification: create a harmless test file with a blocked extension, request it in a browser and confirm access is denied. Delete the test file afterward. Never expose real credentials to test a rule.

6. Přidejte druhé heslo do /administrator s .htpasswd

A web-server authentication prompt can protect Joomla's administrator directory before Joomla's own login form loads. It is an additional layer, not a substitute for Joomla MFA.

Option A: use your hosting control panel

Some hosting panels include Password-protected directories, Directory privacy, or similar functionality. Select the site's administrator directory, create a unique username and password, save the configuration, and test it in a private browser window. Confirm the host does not overwrite Joomla's existing .htaccess rules.

Option B: generate the file locally with Apache

If you have the htpasswd command:

htpasswd -c -B /home/account/private/.htpasswd adminaccess

The command prompts for a password without including it in your shell history. -B selects bcrypt; -c creates or overwrites the file, so use it only when creating a new file. To add another user, omit -c.

Store the resulting file outside the publicly served directory. Then put this configuration in administrator/.htaccess, using the actual absolute path supplied by your host:

AuthType Basic
AuthName "Restricted Joomla Administration"
AuthUserFile /home/account/private/.htpasswd
Require valid-user

Option C: use an online .htpasswd generator, with caution

Online generators can be convenient when you have neither shell access nor a suitable hosting-panel feature. However, entering a password into a third-party website may transmit it in plaintext to its operator or to scripts included on the page. HTTPS protects transport; it does not prove the operator never receives, logs or retains the password.

Some generators process input entirely in browser JavaScript, but that behavior should be independently verifiable. Prefer a trusted local generator or your hosting panel. Never enter a password reused for Joomla, email or another account. If you use an online tool, generate a long, unique password specifically for this additional gate and choose bcrypt when supported. Save only the generated hash in .htpasswd.

Test the extra protection

Open https://example.com/administrator/ in a private browser window. You should first see the HTTP authentication prompt, then the Joomla login, and then MFA when required. Confirm that the public frontend still works.

HTTP Basic authentication must be used over HTTPS. Test compatibility with extensions, API endpoints, scheduled tasks and any workflows that access paths under /administrator. If the site breaks, revert the added rule through SFTP or the hosting file manager.

See the official Apache authentication guide and htpasswd reference.

7. Prevent unsafe execution in upload directories

A compromised upload feature can become especially dangerous if uploaded PHP scripts execute on the server. Where your architecture allows it, configure the server so that user-upload directories cannot execute scripts.

This is hosting-specific: Apache module handlers, PHP-FPM, CGI and Nginx require different approaches. A simple php_flag engine off rule is not portable and may trigger HTTP 500 errors. Do not copy it blindly. Ask your hosting provider for the appropriate non-executable upload-directory configuration, then test both upload functionality and the execution restriction using a harmless test.

8. Secure PHP, HTTPS and file permissions

Use a PHP release supported by your Joomla version and extensions. In production, avoid exposing detailed PHP errors to visitors:

display_errors = Off
log_errors = On
expose_php = Off

Configure these settings through your hosting panel or PHP configuration. Confirm the effective values without leaving a public phpinfo() file online.

Use HTTPS for the entire website, including administrator login. Redirect HTTP to HTTPS and investigate mixed-content warnings. Consider HSTS only after verifying HTTPS across the intended hosts.

On typical Linux hosting, files may use permissions such as 644 and directories 755, but correct permissions depend on ownership and PHP execution mode. Avoid world-writable permissions such as 777. Do not run blanket recursive permission commands without understanding the hosting environment.

Keep configuration.php, database dumps, backup archives, logs and deployment secrets protected from public access.

Technical workflow illustration

9. Create and restore backups with Akeeba Backup

A backup must include both Joomla's files and its database. One established option is Akeeba Backup, which provides Joomla backup and recovery functionality.

  1. Download a compatible Akeeba Backup release from the official website.
  2. Install it using Joomla's extension installer.
  3. Open Akeeba Backup and review its configuration and backup destination.
  4. Run a complete backup of the site and database.
  5. Download or transfer the archive to secure off-site storage. Do not leave backup archives publicly accessible.
  6. Configure scheduled backups if your hosting environment and chosen Akeeba edition support the required method.
  7. Restore a backup in an isolated staging environment to verify that the database, media, configuration and extensions work.

Use the official Akeeba Backup documentation for version-specific setup and restoration instructions.

Practical example: a backup job reports success every night, but the archive contains no uploaded images. Only a staging restoration reveals the missing data. A successful backup notification is not proof that recovery will work.

If the site is compromised, do not automatically restore the newest backup: it may already contain malicious files or compromised accounts. Investigate, select a known-clean recovery point, patch the entry point and rotate affected credentials.

10. Reduce unnecessary attack surface

Disable public registration under Users → Manage → Options if visitors do not need accounts. Remove obsolete administrator accounts and unsupported extensions. Review all authentication paths and ensure no development tools, database dumps or diagnostic pages remain publicly accessible.

Restricting /administrator by IP address or VPN can be useful for teams with predictable access locations. Merely hiding the login URL is not a replacement for MFA and proper authorization.

11. Monitor and verify security

Review hosting logs for unusual requests, unexpected privileged logins, unexplained changes to PHP files and suspicious scheduled tasks. Use file-integrity checks when practical. Do not execute unfamiliar PHP files discovered in an upload directory.

You can assess response headers with SecurityHeaders.com and consult the OWASP Cheat Sheet Series for broader web application security guidance. A favorable scanner grade does not prove that a site is free of vulnerabilities.

Joomla security checklist

  • [ ] Joomla core and third-party extensions are supported and patched.
  • [ ] Every privileged account uses MFA, with tested recovery.
  • [ ] Super User privileges are limited and reviewed.
  • [ ] Editorial permissions have been tested with restricted accounts.
  • [ ] Apache rules are based on Joomla's configuration and tested safely.
  • [ ] Sensitive files and backups are inaccessible from the public web.
  • [ ] The administrator directory has an additional access restriction where appropriate.
  • [ ] PHP and hosting components are supported; detailed errors are not publicly displayed.
  • [ ] HTTPS works everywhere and there are no mixed-content errors.
  • [ ] Backups are stored off-site and have been restored successfully in staging.
  • [ ] Obsolete extensions and unused accounts have been removed.
  • [ ] Logs and suspicious file changes are reviewed.

Frequently asked questions

Is Joomla secure by default?

Joomla includes security features such as ACL, MFA and software updates, but real-world security depends on configuration, extensions, hosting and ongoing maintenance.

Do I need a Joomla security extension?

Not necessarily. Start with updates, MFA, least-privilege permissions, secure hosting and tested backups. Add an extension only to address a defined need and verify that it is actively maintained.

Does .htpasswd replace Joomla MFA?

No. HTTP Basic authentication is an additional barrier. Keep Joomla's own authentication and MFA enabled.

Can I use .htaccess on Nginx?

No. Nginx ignores .htaccess files; equivalent restrictions must be configured in Nginx.

Are online .htpasswd generators safe?

Their behavior varies. Some send the entered password to a server; others claim to process it locally. Prefer local generation, a hosting-panel feature or a tool whose behavior you can verify. Never reuse an existing password.

How often should I test backups?

Test after important infrastructure changes and on a regular schedule appropriate to the site's importance. A quarterly restoration test is a reasonable starting point for many small sites.

Conclusion

Joomla security is not a single plugin or a one-time checklist. Keep the CMS and extensions updated, enforce MFA, limit privileges, harden the hosting environment, protect /administrator when appropriate, and maintain recoverable off-site backups.

The most useful security improvements are those you can verify: sign in with MFA, test a restricted editor account, confirm a sensitive file is blocked, and restore a backup on staging. These practices reduce the likelihood and impact of compromise while making recovery more predictable.