Server Hardening — Linux

The purpose of systems hardening is to minimize security risk by eliminating potential attacks from adversaries and reduce the system’s attack surface.

If you want to make your Linux systems secure, please keep in mind these steps as below.

We will discuss about these steps in detail with another article soon.

Restriction of access on HTTPS to any website via IP Address on NGINX

It is recommended to access any web site via domain address instead of IP address, therefore please use the following steps to configure your NGINX.

server {
listen 443 ssl;
server_name test.com

ssl_certificate /etc/nginx/ssl/test.com.crt;
ssl_certificate_key /etc/nginx/ssl/test.com.key;
if ($host != "test.com") {
return 301 $scheme://test.com$request_uri;
}
}

After configuration is saved, reload your NGINX:

# service nginx reload

After NGINX reloaded, It will redirect all direct accesses using IP address to https://test.com along with the URI in the request.

Mehmet Fatih KOCALAR

Cyber Security — R&D

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