Skip to content

Instantly share code, notes, and snippets.

@nurmdrafi
Last active September 17, 2023 07:23
Show Gist options
  • Save nurmdrafi/af4578aee31a2ed100e993baebafa701 to your computer and use it in GitHub Desktop.
Save nurmdrafi/af4578aee31a2ed100e993baebafa701 to your computer and use it in GitHub Desktop.
The NGINX Handbook

The NGINX Handbook for beginners - freecodecamp.org

How To Run Nginx in a Docker Container on Ubuntu 22.04 - digitalocean.com

How To Set Up Nginx Server Blocks on Debian 9 - linuxize.com

How To Set Up Nginx Server Blocks (Virtual Hosts) on Ubuntu 16.04 - digitalocean.com

Requesting a TLS/SSL Certificate Using Certbot - linode.com

Introduction to NGINX

Nginx is an open-source web server software that is used to manage and deliver web content, handle reverse proxying, load balancing, and more. It is known for its stability, reliability, and performance, making it a popular choice for high-traffic websites and web applications. Nginx was first released in 2004 and has since become one of the most widely used web servers in the world.

One of the key advantages of Nginx is its ability to handle a large number of concurrent connections with minimal resources. This is achieved through a non-blocking, event-driven architecture that allows it to handle thousands of connections simultaneously. Additionally, Nginx is highly configurable and can be customized to meet the specific needs of a website or application. This makes it a versatile web server that can handle a wide range of use cases.

Nginx is also known for its security features, including protection against common web attacks such as DDoS, SQL injection, and cross-site scripting (XSS). It is designed to minimize the attack surface of a web server and reduce the risk of vulnerabilities. This is especially important for websites and applications that deal with sensitive data or handle financial transactions. Overall, Nginx is a powerful and reliable web server that can provide a solid foundation for any web project.

server {

  server_name _;

  location / {
      proxy_set_header Host $host;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_pass http://127.0.0.1:3050/;
  }
}


server {
   server_name admin.barikoi.com;

   location / {
     proxy_set_header Host $host;
     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
     proxy_set_header X-Real-IP $remote_addr;
     proxy_pass http://127.0.0.1:3051;
   }

    listen [::]:443 ssl; # managed by Certbot
    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/admin.barikoi.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/admin.barikoi.com/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}


server {
    if ($host = admin.barikoi.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


   server_name admin.barikoi.com;

  listen [::]:80;
  listen 80;
    return 404; # managed by Certbot


}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment