Skip to main content

Posts

Showing posts with the label Linux

How to add custom headers on Nginx depending of which domain name is comming the request

This is something useful, some times it can be useful to add a custom header but to a different domain name, let's take a look at this scenario, let's supposed you've got a Multitenant application and there are many databases, and an user can be stored in one of those databases, we need to identify in somehow in the login where that customer comes from, and what about if we have got several domain names pointing to the same application server like this companyone.com --> applicationServer companytwo.com --> applicationServer companythree.com --> applicationServer we must identify with Nginx where the request is coming from, and set a custom token ID  in the header so in that way the front can get that token ID from the header and send it to the backend and once it is in there we can then now know from which database belongs that token ID server {       large_client_header_buffers 4 32k ;       listen 80 ;     ...

Integrating phpMyAdmin with Amazon RDS Service – MySQL Instance

I found this a very interested solution when you are working with RDS and you need a phpmyadmin on your instance In this tutorial, we will demonstrate the integration of phpmyadmin with running Amazon RDS MySQL instance. Kindly follow the instructions listed below. Default Document Root folder: /var/www/html cd /var/www/html Download phpMyAdmin from the authorized website or use the wget command below. wget https://files.phpmyadmin.net/phpMyAdmin/4.7.3/phpMyAdmin-4.7.3-all-languages.zip Unzip the phpMyAdmin. unzip phpMyAdmin-4.7.3-all-languages.zip mv phpMyAdmin-4.7.1-all-languages phpmyadmin && cd phpmyadmin Edit the configuration file for phpMyAdmin. mv config.sample.inc.php config.inc.php Default File vim config.inc.php /* Server parameters */ $cfg['Servers'][$i]['host'] = 'localhost'; $cfg['Servers'][$i]['compress'] = false; $cfg['Servers'][$i]['AllowNoPassword'] = false; Modification Instructi...

How to autostart a Java jar after the OS has been restarted - Centos7/8

If you need to autostart a jar after your operative system has been rebooted using Centos 7/8, then you need to create a service, to do that go to /etc/systemd/system and create in there the name of the service you want to start your app, I gave in this example the service name as  springboot.service I am working with screen for the purpose of this example before starting you need having screen installed, if you don't have it run yum install screen so vim  springboot.service and paste the next instructions in order to set up your service, replace the jar name and the WorkingDirectory by yours, the WorkingDirectory is usually where the jar is so that in most common cases in that directory is where your application.properties and other settings you've got [Unit] Description=JavaSpringBoot After=network- on line.target [Service] Type=forking User=root Group=root WorkingDirectory=/home/centos/springboot_jwt/ ExecStart=/usr/bin/screen -S springboot -d -m /usr/...

Nginx Reverse Proxy in front of SpringBoot

In the last post we were doing some exercises about how to deploy a VueJS app with SpringBoot using SSL, but exposing the whole backend with SSL is not recommended because of security things, the best thing to do is let the backend running just in localhost mode and using this powerful tool which Nginx gives us the Reverse Proxy to be in front the SpringBoot app int this case. What is a reverse proxy? A reverse proxy is a server that sits in front of web servers and forwards client (e.g. web browser) requests to those web servers. Reverse proxies are typically implemented to help increase security, performance, and reliability. let's suppose you've got in your backend 2 endpoints running through the port 7075: /docker/itemspaginados/0 /docker/createitems/ so if the backend is up and running you can run in the server curl http://127.0.0.1:7075/docker/itemspaginados/0  you should get back something like: {"totalItems":"5","totalPages":...