Nginx 101 — Part 2

I hope you have basic understanding about Nginx. What it is and how we can use it as a proxy. I have explained them in my previous port. Today lets talk about some other benefits we can get from Nginx (before going to LoadBalancing). This will be a shorter description.

Regular Expressions

We can use regular expressions in our nginx configuration to do simple routing. ~ is used to indicate we are going to use regex in our nginx config. Following config can be used to block serving .jpg images to users.

location /images {
root /home/project/images/;
# check whether it tries to serve .jpg files.location ~.jpg {
return 403;

This configuration will block any request coming to /images/[a-z0-9].jpg

Content blocking

If we want to block users accessing some specific routes over the internet, we can use nginx config.

server {    listen 80;    location /admin {        return 403;

Above configuration will simply block users accessing our_domain/admin route over the internet (as port 80 is used). But still this will allow users to access same route using a port (if its running there). Such as our_domain:7800/admin




DevOps who is willing to learn and try new things.

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

Recommended from Medium

Let’s Use JavaScript to Make a Screen Recorder

Summer of Javascript

Remote Code Execution Vulnerability in Electron Apps

Learn p5.js by Making Fractals

In the microfontend part of the frontend world

JavaScript Algorithm: Where Do I Belong

Let’s build Redux-Saga from scratch

Commonly used commands in an Angular application

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
Sachith Muhandiram

Sachith Muhandiram

DevOps who is willing to learn and try new things.

More from Medium


How to Reset Jenkins Admin User Password

REST Services

Running MongoDB in a Docker Container