Job Hailing and Outsourcing Web Service With NodeJS, MYSQL & NGINX
"Corrde" is a stylized approach at abbreviating the service's core features which are, "mapping coordinates" and "coordinating freelance services"
###Prerequisites
npm
NodeJS
mysql-server
nginx
####Install node.js
and npm
Node.js is available in Ubuntu repository and you can easily install it in a few commands
sudo apt install nodejs
and install npm
sudo apt install npm
Install Nginx
sudo apt install nginx
Adjusting NGINX
configuration file:
- Now we need to configure
nginx
as a proxy for our directory level resources. Yournginx.conf
file; located in the/etc/nginx/
directory, should explicitly look like this:
#user nobody;
worker_processes auto;
pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
sendfile on;
keepalive_timeout 65;
gzip on;
server {
listen 80 default_server;
listen [::]:80 default_server;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
ssl_certificate /var/www/corrde/http2/ssl/server.crt;
ssl_certificate_key /var/www/corrde/http2/ssl/server.key;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location / {
proxy_pass https://127.0.0.1:8124;
}
location /gp {
root /etc/corrde;
}
}
}
You need to restart nginx
to reload the new configuration file.
sudo systemctl restart nginx
####Install mysql
sudo apt-get update
sudo apt-get install mysql-server
If the secure installation utility does not launch automatically after the installation completes, enter the following command:
sudo mysql_secure_installation utility
- Make sure you are running a secure
mysql-server
, to facilitatenodejs
access. For versions earlier thanMYSQL 5.7
, enter the following command in themysql
shell, replacepassword
with your new password:
UPDATE mysql.user SET Password = PASSWORD('password') WHERE User = 'root';
or for versions after MYSQL 5.7
run:
UPDATE mysql.user SET authentication_string = PASSWORD('password') WHERE User = 'root';
To make the changes take effect, reload the stored user information with the following command:
FLUSH PRIVILEGES
-
Clone
corrde
github repository at local directory/var/www/
git clone https://github.com/mannasugo/corrde/
-
Install
package
dependencies withnpm
npm install
-
Adjust
mysql
access credentials to your credentials fornode-mysql
module, alter/var/www/corrde/corrde-config.js
at this section:sqlPass: { h: `localhost`, u: `root`, p: `Mann2asugo`, d: `corrde`}
to
sqlPass: { h: `localhost`, u: `root`, p: `(Your Mysql Password)`, //assign your system mysql password to this element d: `corrde`}
-
Run
nodejs package
npm start
-
Access
local_env
in browser:https://localhost