Installer NGINX NodeJS & NPM
sudo apt install nginx
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt install -y nodejs
Installer les dependances
npm install mysql express body-parser
server {
listen 80;
server_name domain.com;
location / {
proxy_pass http://localhost:3000;
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 ;
}
}
CREATE DATABASE IF NOT EXISTS testdb;
USE testdb;
CREATE TABLE IF NOT EXISTS users (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255),
email VARCHAR(255)
);
curl -X POST -H " Content-Type: application/json" -d ' {"name": "John Doe", "email": "john@example.com"}' http://SERVER_IP/users
curl http://SERVER_IP/users
lsblk
sudo file -s /dev/xvdf
sudo mkfs -t ext4 device_name
sudo mount device_name mount_point