How to Safeguard Apache Web Server on Ubuntu

Setup Apache Web Server

$ sudo apt-get install apache2
http://ip_address

Creating ModEvasive Log Directory

$ sudo mkdir /var/log/mod_evasive
$ sudo chown -R www-data:www-data /var/log/mod_evasive
$ sudo systemctl restart apache2

Testing ModEvasive

$ sudo nano /usr/share/doc/libapache2-mod-evasive/examples/test.pl
print $SOCKET "GET /?$_ HTTP/1.0\n\n";
print $SOCKET "GET /?$_ HTTP/1.0\r\nHost: 127.0.0.1\r\n\r\n";
$ sudo perl /usr/share/doc/libapache2-mod-evasive/examples/test.pl
...
HTTP/1.1 200 OK
HTTP/1.1 200 OK
HTTP/1.1 200 OK
HTTP/1.1 200 OK
HTTP/1.1 200 OK
HTTP/1.1 200 OK
HTTP/1.1 200 OK
HTTP/1.1 200 OK
HTTP/1.1 200 OK
HTTP/1.1 200 OK
HTTP/1.1 403 Forbidden
HTTP/1.1 403 Forbidden
HTTP/1.1 403 Forbidden
HTTP/1.1 403 Forbidden
..
$ sudo ls -a /var/log/mod_evasive
.  ..  dos-127.0.0.1
$ sudo tail /var/log/apache2/error.log
...
[evasive20:error] [pid 31967] [client 127.0.0.1:43954] client denied by server configuration: /var/www/html/.
...

Related Blog Posts

How to Setup Hadoop Cluster Ubuntu 16.04

How to Install and Configure Seafile on Ubuntu 16.04

Related Market Product

LAMP Stack(Apache PHP5.6 MySQL5.6) on Ubuntu16

Related Documentation

Harden Apache service security

[Vulnerability notice] Multiple Apache httpd vulnerabilities

Related Products

Anti-DDoS Pro

Elastic Compute Service

Related Course

Use Anti-DDoS Basic and Pro to Defend DoS Attack

--

--

--

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website:https://www.alibabacloud.com

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Coda: Learning From Structures Around Us

Leetcode 230. Kth Smallest Element in a BST

What happens when you type ‘gcc main.c’

The easiest way to create Terraform Modules and set up Terraform Cloud with github.com and AWS

5 Wrong Ways To Save Money

Case Study on Samsung — How is it leveraging AWS to stay on front line

GOP congressman’s lawsuit that sought to invalidate mail-in votes

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alibaba Cloud

Alibaba Cloud

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website:https://www.alibabacloud.com

More from Medium

Azure IoT Edge with proxy and Certificate

Docker deep level with architecture — part 1

Self managed EFK Setup for 10 billion+ documents

No Setup Development: Productivity Experience with Docker