-
-
Save adamryan1983/39d1f0f1201333db91e559339d4495c4 to your computer and use it in GitHub Desktop.
Revisions
-
iam-hussain revised this gist
Feb 28, 2022 . 1 changed file with 5 additions and 1 deletion.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -25,4 +25,8 @@ sudo ufw allow 'Nginx Full' # Port verification sudo lsof -i TCP:80 #for SSH # https://www.nginx.com/blog/using-free-ssltls-certificates-from-lets-encrypt-with-nginx/ -
iam-hussain revised this gist
Feb 28, 2022 . 1 changed file with 11 additions and 0 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,10 +8,21 @@ sudo nginx -s reload # Status sudo systemctl status nginx # start sudo systemctl start nginx # Restart sudo systemctl restart nginx # Stop sudo systemctl stop nginx # Nginx Security sudo ufw app list sudo ufw allow 'Nginx Full' # Port verification sudo lsof -i TCP:80 -
iam-hussain revised this gist
Feb 28, 2022 . 1 changed file with 17 additions and 0 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ # Test Nginx config sudo nginx -t # If you got error then just delete the log.txt file then sudo nginx -s reload # Status sudo systemctl status nginx # Restart sudo systemctl restart nginx # Nginx Security sudo ufw app list sudo ufw allow 'Nginx Full' -
iam-hussain revised this gist
Nov 11, 2021 . 2 changed files with 2 additions and 6 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,12 +1,10 @@ # Serve nextJS app from a port through NGINX reverse proxy (HTTP) # Path: /etc/nginx/sites-available/default # Default server configuration for HTTP server { server_name www.DOMAINNAME.com DOMAINNAME.com; # Serve any static assets with NGINX location /_next/static { alias /home/ubuntu/PROJECT_FOLDER/.next/static; This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,12 +1,10 @@ # Serve nextJS app from a port through NGINX reverse proxy (HTTPS) # Path: /etc/nginx/sites-available/default # Default server configuration for HTTPS server { server_name www.DOMAINNAME.com DOMAINNAME.com; # Serve any static assets with NGINX location /_next/static { alias /home/ubuntu/PROJECT_FOLDER/.next/static; -
iam-hussain revised this gist
Nov 2, 2021 . 2 changed files with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes.File renamed without changes. -
iam-hussain revised this gist
Nov 2, 2021 . 2 changed files with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes.File renamed without changes. -
iam-hussain created this gist
Nov 2, 2021 .There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,39 @@ # Path: /etc/nginx/sites-available/default # Default server configuration for HTTP server { server_name www.DOMAINNAME.com DOMAINNAME.com; index index.html index.htm; root /home/ubuntu/PROJECT_FOLDER; #Make sure your using the full path # Serve any static assets with NGINX location /_next/static { alias /home/ubuntu/PROJECT_FOLDER/.next/static; add_header Cache-Control "public, max-age=3600, immutable"; } location / { try_files $uri.html $uri/index.html # only serve html files from this dir @public @nextjs; add_header Cache-Control "public, max-age=3600"; } location @public { add_header Cache-Control "public, max-age=3600"; } location @nextjs { # reverse proxy for next server proxy_pass http://localhost:8080; #Don't forget to update your port number proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; } listen 80 default_server; listen [::]:80; } This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,62 @@ # Path: /etc/nginx/sites-available/default # Default server configuration for HTTPS server { server_name www.DOMAINNAME.com DOMAINNAME.com; index index.html index.htm; root /home/ubuntu/PROJECT_FOLDER; #Make sure your using the full path # Serve any static assets with NGINX location /_next/static { alias /home/ubuntu/PROJECT_FOLDER/.next/static; add_header Cache-Control "public, max-age=3600, immutable"; } location / { try_files $uri.html $uri/index.html # only serve html files from this dir @public @nextjs; add_header Cache-Control "public, max-age=3600"; } location @public { add_header Cache-Control "public, max-age=3600"; } location @nextjs { # reverse proxy for next server proxy_pass http://localhost:8080; #Don't forget to update your port number proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; } listen [::]:443 ssl ipv6only=on; listen 443 ssl default_server; # Update with your SSL files. This is certbot genrated SSL details # Steps to generate cerbot SSL https://certbot.eff.org/lets-encrypt/ubuntufocal-nginx ssl_certificate /etc/letsencrypt/live/SOME_PROJECT_NAME/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/SOME_PROJECT_NAME/privkey.pem; include /etc/letsencrypt/options-ssl-nginx.conf; ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; } server { if ($host = www.DOMAINNAME.com) { return 301 https://$host$request_uri; } if ($host = DOMAINNAME.com) { return 301 https://$host$request_uri; } listen 80 ; listen [::]:80 ; server_name www.DOMAINNAME.com DOMAINNAME.com; return 301 https://$host$request_uri; }