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

How to work with MultiSelect Option Set Fields in Dynamics 365 v9 | R.iT News-Blog

January 18 2017 at 09:19PM

Learning Angular Prerequisites

Creating a Simple Event Handler for Javascript

2017 Daily Sketches

Mobile friendly navigation in React and HOC

MVC with JSP

Some Gotchas when learning React

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

Parsing JSON in command-line with jq: basic filters and functions

Installing and Setting up MongoDB on Linux

Docker in simple words

Enabling MySQL Logs In The Linux Environment