How To Harden Apache Web Server on Rocky Linux 8.5
How To Harden Apache Web Server on Rocky Linux 8.5
in This Tutorial you will Learn " How To Secure and Harden Your Apache Web Server On Rocky Linux 8.5 "
Apache is one of the most widely-used and popular web servers. It is also one of the most secure web servers available.
Apache is a popular web server used by millions of websites all over the world. As a result, they are often prey to security vulnerabilities and attacks. It is important to secure your Apache server against malicious attacks.
_________________________________________________________________________________________
Server - Os: Rocky Linux 8.5 64Bit | IP -192.168.1.20 | Hostname - www.primaryhost.com
_________________________________________________________________________________________
cat /etc/system-release ; httpd -v
_________________________________________________________________________________________
1. Hide Apache Server Name
gedit /etc/httpd/conf/httpd.conf &>/dev/null
ServerSignature Off
ServerTokens Prod
apachectl configtest
_________________________________________________________________________________________
2. Turn Off Directory Listing
gedit /etc/httpd/conf/httpd.conf &>/dev/null
<Directory /var/www/html/>
Options -Indexes
AllowOverride None
Require all granted
</Directory>
apachectl configtest
________________________________________________________________________________________
3. Disable Unnecessary Modules-
grep LoadModule /etc/httpd/conf.modules.d/00-base.conf
gedit /etc/httpd/conf.modules.d/00-base.conf &>/dev/null
#LoadModule info_module modules/mod_info.so
#LoadModule userdir_module modules/mod_userdir.so
_________________________________________________________________________________________
4.Disable Symlinks-
gedit /etc/httpd/conf/httpd.conf &>/dev/null
Options -Indexes -FollowSymLinks
apachectl configtest
_________________________________________________________________________________________
5. Disable SSI & CGI Execution
gedit /etc/httpd/conf/httpd.conf &>/dev/null
Options -Indexes -FollowSymLinks -ExecCGI -Includes
apachectl configtest
_________________________________________________________________________________________
6. Protect from Clickjacking
gedit /etc/httpd/conf/httpd.conf &>/dev/null
Header append X-FRAME-OPTIONS "SAMEORIGIN"
apachectl configtest
_________________________________________________________________________________________
7. Disable ETags
gedit /etc/httpd/conf/httpd.conf &>/dev/null
FileETag None
apachectl configtest
_________________________________________________________________________________________
8. Protect from XSS attacks.
gedit /etc/httpd/conf/httpd.conf &>/dev/null
<IfModule mod_headers.c>
Header set X-XSS-Protection "1; mode=block"
</IfModule>
apachectl configtest
_________________________________________________________________________________________
systemctl daemon-reload ; systemctl restart httpd ; systemctl status httpd
Related Posts:
- How To Setup LVS (Linux Virtual Server) Load Balancer on Rocky Linux 8.5
- How To Install Magento 2.4 on Rocky Linux 8
- How To Install Docker on Oracle Linux Server 9
- How to Install WHM/cPanel in Almalinux?
- Configure NTP Server in Oracle Linux 9
- How To Install Ruby on Rails with PostgreSQL on Rocky Linux 8
- How To Install EMQX MQTT Broker on Rocky Linux 8
- How To Install Kamailio SIP Server on Rocky Linux 8
- How to Install and Configure RabbitMQ Server on Rocky Linux 8
- Setup Quick DNS Server On Rocky Linux 8.5 Using Dnsmasq
Latest Posts
- Server-Side Scripting: PHP, Node.js, Python – A Detailed Comparison
- Securing Your Website in 2024: Essential Strategies for Online Safety
- The Future of Web Development Technologies: Trends to Watch in 2024
- How Banks Handle Server-Side Operations and Ensure System Security: An Inside Look
- Tips for Writing Clean, Understandable, and Efficient Code: Avoiding Garbage Code
- Tailwind CSS: Revolutionizing Modern Web Design
- Basic Linux Commands for Beginners: A Starter Guide
- Dairy Farming Loan Apply
- BSNL Recharge Plan
- Bijli Bill Mafi Yojana Online Apply
Technical
- DevOps Roadmap
- How To Install and Configure an SNMP on Ubuntu 20.04
- Apple releases iOS 18 Developer Beta 2 with iPhone screen mirroring, RCS toggle,and more
- How to enable SNMP on Ubuntu Linux 18.04 and above
- How to Force HTTPS Using .htaccess (Updated 2024)
- Display All PHP Errors: Basic & Advanced Usage
- PHP alert
- MongoDB loads but breaks, returning status=14
- MongoDB database deleted automatically
- MongoDB all Error Solutions
Category