Installing an EJS Website
Screen Sessions Guide
Install FFmpeg
NGINX Upload Limits
Dark Bot Install
Invalid Redirects
DISALLOWED_INTENTS
Payment System Licensing
Dark Bot Music Linux
Hyperz Docs > Knowledgebase > Installing an EJS Website
Installing an EJS Website
This default guide uses Ubuntu 20.04 as an operating OS. We may release a guide for Windows at some point in the future.
Note: This guide will not work for all EJS Based websites, this is designed to work with the basics.
DO NOT USE / INSTALL APACHE!!!
-server-to-host-the-site-nginx-nodejs-domain"> Step 1 - Requirements - Server to host the site
- Nginx
- NodeJS
- Domain
- Server to host the site
- Nginx
- NodeJS
- Domain
Step 2 - LEMN Stack
Props to FAXES for an explanation on this part
A LEMN stack is a group of programs that will be the core operators for our website.
- Linux
- Engine-X (but written as Nginx)
- MySQL Database
- NodeJS
You might of heard of a LEMP, or LAMP stack. These include PHP. However, this application uses Node.Js as an handler. So we will use the LEMN Stack.
First off after we login to the terminal. We want to update the package index. then install Nginx.
Actions:
First, lets get logged into our server.
We are going to be using WinSCP & PuTTY
Open up PuTTY and input your IP into the Host Name box.
Then when it asks to login as:
likely your username will be root
If it asks for a password, enter your password. If you don't know your password, reach out to your hosting provider.
Keep in mind the console won't show you as "typing" when entering a password. This is a security feature and it keeps your text entry invisible to other users.
Now onto the next step(s):
Lets make sure we are up to date, so lets run sudo apt update
in console.
Then let's get to installing NGINX with this command:
sudo apt install nginx
When prompted press Y
to install Nginx.
Now you should be able to navigate to your server IP in a browser and you will see the Nginx welcome page - http://server_domain_or_IP.
MySQL
If your current EJS website doesn't require a MySQL Database, feel free to skip ahead!
Start off by running this command to install the base of MySQL:
sudo apt install mysql-server
When prompted press Y
to install MySQL-Server.
Then lets login to MySQL:
sudo mysql
Then, lets set a password for your new MySQL Server!
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
Next lets make sure to refresh our permissions.
FLUSH PRIVILEGES;
If you wish to learn MORE about MySQL x Ubuntu feel free to check out the knowledge base article.
Install NodeJS
Install NVM
sudo apt update
sudo curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
then run this all in one line
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && . "$NVM_DIR/bash_completion"
then continue running these commands below
nvm --version
nvm ls
nvm install 16.13.2
nvm use node
to set the default simply do
nvm alias default 16.13.2
(Those of you looking for a windows download go here.)
Certbot
Lastly we need to install Certbot to be able to use SSL certificates on our domain(s).
sudo apt install certbot python3-certbot-nginx
NGINX Configuration
Credit to FAXES on this part.
Because EJS Websites use NodeJS to function we need to setup a proxy to have our website work on a domain through NGINX. Navigate to your NGINX site config: /etc/nginx/sites-available/default
Insert the below into your config file. Ensure to edit the relevant points. If this is your first time editing this file, you may feel free to delete all other content inside of it, so you start blank before pasting this in.
server {
server_name example.com; # Change domain to yours.
location / {
proxy_pass http://localhost:3000; # Change the port if changed in the config file.
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;
proxy_set_header X-Real-IP $remote_addr;
}
}
Restart Nginx to make the changes.
sudo systemctl restart nginx
Now create a SSL certificate through Certbot.
sudo certbot --nginx -d example.com
If instructed you want to pick the second option (2) to redirect all traffic to a https connection.
Run sudo certbot renew --dry-run
to make sure your SSL certificates auto-renew.
Running your website
Now, let's actually install dependencies and start your website on the port of your choice!
cd to the directory of your website, for example: cd /home/website
Next, lets install the dependencies, for me, that will be done with npm i
Once the dependencies have finished installing, finally, let's start the website with node .
Review this page