I recently rented a new server from OVH cloud, they are super cheap check them out.
NO, they do not sponsor me.
Getting your hand into nginx without any prior knowledge about servers and reverse proxies and all those fancy terms, can be difficult
Although it is important that to learn all of them, sometimes you just want it working and quickly.
First lets get the concept out of the way.
Revers proxy server is used to hide all the mess the developer has made behind a single ip.
Lets start with a normal server, you take a domain name like "www.example.com" and point it to an ip, hopefully the ip of your server and whenever someone searches your domain name in a browser or by any other way that goes to the port 80 or 443 of your server based on http or https.
Things start to get out of hand when you use server name, like "other.example.com" and "somethingelse.example.com" or "whatever.example.com". These nameservers come when you rent the domainname, and you can aim them to other servers or the same server.
If you are anything like me you don't want to buy different servers for each and every project or nameserver. What you can do instead is serve your content on different ports on the same server and tell nginx to to set nameservers to ports on localhost of that machine.
And to set these thing up you need to ssh into the server and edit the unreadable nginx config. Thats is why I made NRPS, after setting up NRPS you get a front-end webapp on which you can view or edit the nginx config with easy input menues and stuff.
You should be on an unix based system, meaning a mac or some distribution of linux.
Windows does not work yet.
You can find out how to install these on the internet.
There are two parts to it the backend(flask) and the frontend(vue). Because of all the passwords and lack of developers still to deal with them, you have to go in and put in a few things by hand, but dont worry I will share each and every step here so hang tight.
First lets get all the file we need on a local machine. There are 2 ways to do this. If you have git installed(which you should) just do
git clone https://github.com/abhishek-deshmukh/NRPS/tree/v0.2.0
or if you don't have git, then you can download it form here
You should have a directory structure like this:
yes it might look overwhelming but don't worry you only have do a few things to get this working.
Now open the file backend/api.py in your favourite text-editor(vim). on lines 11 and 12 enter username and password inside the quotes like so.
okay now the backend should has all the things inside it ready.
Lets set up a few things inside the frontend now shall we? open the file
frontend/src/store/index.ts
again in your favorite text editor(vim) and look for
rootIP
and put in the ip of your remote server in quotes provided and then just below that put in a name for the server in quotes
now go to the base directory, and run
If you get a security issue run chown +x build.sh and then try again.
The setup is complete, and in the build files are in the folder called build, if you know how to move them to the server do that and skip this part, and if you don't then read along, now lets move these things to your server.
Assuming you are a user on the server and you have the password for the user, we can `scp` the files into the server, `scp` is used to send files over ssh.
Now go to the base directory and run
In the above command replace user with you username on the server and the ipaddress with the ipaddress of your server.
When you run it will prompt you for the password of the user on the remote server, I would recommend giving it that.
Now that the build files have been moved to the server lets deploy it on the server on part at a time
Now to connect to the server we will use ssh
After which it will ask for the password of the user on the server, I would recommend you give it that.
These are things to be installed on the server.
Most servers run ubuntu so, I am giving installation commands for ubuntu but all these packages should be in the package managers of your distribution.
These were installed on the server:
Once these things are installed lets move on to deploying the backend.
Lets begin by getting sudo access
this will prompt you for a password of the user on the server, put that in and your prompt should change to something like root@something #
Now go into the build/ folder and run
Replace ip-address with the ip of your remote server and example.com with domain name you want nrps hosted at.
If you run into any permission issues run:
The deployment is complete.
You can visit Nodejs.org for details on how to do that.
There are a lot of possible things that could have gone wrong but usually it is the firewall just run:
and everything should be working.
Yes, If the other server has https instead of http in its url, then put http in place of location, the browser will switch to https on its own.
edit the username and password in /etc/nginx/nrps/api.py and then you will have to restart supervisorctl for the new code to take action, to do that the run:
If you run into any issues e-mail me, I would love to help you out.