Nginx

Nginx Server Notes

Nginx Server Notes

Nginx
I struggled a lot to understand nginx during my first assignments in nginx configurations for one of the angular deployments and little interesting things in it. I captured as much as possible in this post to help someone who is like me!! Below entries are added to nginx.conf file which usually exist in /etc/nginx/nginx.conf Basic commands: sudo service nginx start - to start nginx server sudo service nginx stop - to stop nginx server sudo service nginx status - returns the current status sudo service nginx restart - restarts the nginx server   Converting uppercase url to lowercase: This is actually highly recommended if you are going to deploy an application which is like shopping/any end user needed site and expecting better SEO. # As your first location entr...

IP Canonicalization in Nginx Http/Https

Nginx, SEO
IP Canonicalization in Nginx Http/Https: IP canonicalization is to redirect IP Address to the domain. This actually a part of SEO, so good to have IP canonicalization, but you can't achieve this using shared web hosting. IP Canonicalization in Nginx Http/Https: Add the below block to above of your default server block in your nginx conf file, which is default available in /etc/nginx/nginx.conf This below block works for both http and https IP canonicalization in nginx server. [code] server { listen *:80; listen *:443 ssl http2; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_certificate "/etc/letsencrypt/live/ngdeveloper.com/fullchain.pem"; ssl_certificate_key "/etc/letsencrypt/live/ngdeveloper.com/privkey.pem"; server_name 18.218.X.X; return 301 https://ngdeveloper.com; } ...

Creating keystore.p12 from letsencrypt certificate for spring boot projects:

Frameworks, Linux/Unix, Nginx
Creating keystore.p12 from letsencrypt certificate for spring boot projects: Step 1: Stop your server If your server is nginx then use the below command to stop the server. sudo service nginx stop   Step 2: Generating new letsencrypt certificate This is to create the new letsencrypt certificate, if you already have one certificate then skip this step. ./certbot-auto certonly -a standalone \ -d ngdeveloper.com -d www.ngdeveloper.com -d admin.ngdeveloper.com here -d takes all this domains for this certificates, meaning the same certificate can be used for ngdeveloper.com/www.ngdeveloper.com and admin.ngdeveloper.com domains and subdomains. Step 3: Converting letsencrypt to keystore.p12 go to /etc/letsencrypt/live/YOUR-CERTIFICATE-FOLDER/ sudo openssl pkcs12 -export -in full...
How to renew letsencrypt ssl certificate in cent os aws ec2 ?

How to renew letsencrypt ssl certificate in cent os aws ec2 ?

Linux/Unix, Nginx
How to renew letsencrypt ssl certificate in cent os aws ec2 ? Please go to the folder where you already installed letsencrypt (first time), path may be, /etc/letsencrypt in my case. Inside that You can find a file called letsencrypt-auto.   Run the below command inside letsencrypt-auto folder: ./letsencrypt-auto renew     Could not find letsencrypt-auto folder ? In my case it is found inĀ /letsencrypt/letsencrypt path   You can also use this below find command to search letsencrypt folder: find / -name "letsencrypt" here / tells to search from the main directory with the name "letsencrypt", you will get the search results something like this if it is found in your system, /letsencrypt /letsencrypt/letsencrypt /var/lib/letsencrypt /var

How to deploy angular 2/4/5/6 application from bitbucket to Nginx Server in AWS EC2

Angular, AWS, Git/Bitbucket, Nginx
How to deploy angular 2/4/5/6 application from bitbucket to Nginx Server in AWS EC2: Prerequisite: Make sure you have installed following in your linux machines: Nginx server. git. Account in bitbucket (atleast in github to clone some angular app).   1. Create temp folder in root path and do git clone: sudo git clone -b my-Branch https://YOURUSERNAME@bitbucket.org/YOURUSERNAME/YOURPROJECT Here my-Branch is branch name, if you want the master to be cloned then your url will be like this, sudo git clone https://YOURUSERNAME@bitbucket.org/YOURUSERNAME/YOURPROJECT 2. Now get into your project folder and run the below steps: sudo sudo npm install and sudo sudo ng build --prod sudo sudo given two times to solve the permission related issues, prefer to give...