Nginx is an important piece on the working chain apps so that it works as bridge between the end user and the application servers, to do that we will be using nginx as a reverse proxy
to know more in deep about nginx reverse proxy go to https://docs.nginx.com/nginx/admin-guide/web-server/reverse-proxy/
let's suppose you have a domain name called yourdomainame.com
Nginx - ReactJS/Vuejs
each time you need to create a new domain name, set it on the path /etc/nginx/conf.d/ create a file with vim or nano or whatever you want, and give it the domain name .conf and set the settings on it, this is really useful when you start handling several domain names under the same server
vim /etc/nginx/conf.d/yourdomainame.com.conf
these setting work for both ReactJS and VueJS, this is in the case you only need running a frontend app without any backend
Nginx - ReactJS/Vuejs with SpringBoot without Docker
let's suppose you have backend in SpringBoot, and you have got to main prefix endpoints for your backend /api and /login and it is running over the 7078 port then you would need to do
Nginx - ReactJS/Vuejs with SpringBoot with Docker
Let's suppose you have got already your project running with Docker, and the backend keeps working in the 7078 port and let's suppose you you have working an nginx frontend ReactJS or VueJS docker container running in the 81 port, and you don't want to set SSL to the docker nginx, but you rather preffer having an nginx before the container docker nginx as reverse proxy for your frontend app and backend app
Nginx - Django with Docker
Let's suppose you have got already a django project running with Docker over the port 8000 and you don't want to set SSL to the docker nginx, but you rather
preffer having an nginx before the container docker nginx as reverse
proxy for your frontend app and backend app
Nginx - Django restframework with ReactJS/VueJS with Docker
Let's suppose you have got already a django restframework project running with Docker over the port 8000 and let's suppose you have working an nginx frontend ReactJS or VueJS docker container running in the 81 port and you don't want to set SSL to the docker nginx, but you rather preffer having an nginx before the container docker nginx as reverse proxy for your frontend app and backend app
Nginx - Laravel - NuxtJS using Docker
it is the same concept, if you have got your backend running for instance in the 8001 port and the front running in the 3000 both of the running over docker, but you do not want to set SSL to the docker container image for the frontend, instead of that you preffer having an nginx behind like in the main the server, then you should something like this
Note: SSL can be handle through many ways, with AWS, CloudFlare or manual buying the certificates with many companies, this one is quite well https://www.namecheap.com/security/ssl-certificates or you can handle the SSL in an automatic way with certbot tool, I like a lot certbot so that it makes everything for me just giving it the email administrator and the domain name and that's it !, it makes the redirections in the nginx config file which the domain is, just running:
certbot certonly --noninteractive --agree-tos
--cert-name ${SITE_TLD} -d ${SITE_DOMAIN_ONE} -d ${SITE_DOMAIN_TWO} -m
${SSL_EMAIL}
certbot --nginx --noninteractive --agree-tos
--cert-name domainname.com -d domainname.com -d www.domainname.com -m
webmaster@domainname.com
Comments
Post a Comment