in This Tutorial you will Learn " How To Deploy Preact JS Preact-cli with Nginx On Rocky Linux 8.5"
What is Preact?
Preact is a JavaScript library, claiming to be a “fast 3kB alternative to React with the same modern API”. It is one, implementing the fastest virtual DOM, compared to other frameworks on the market. Also, it is one of the smallest libraries in size!
NGINX is an open-source web server software that serves as a reverse proxy, HTTP load balancer, and email proxy for IMAP, POP3, and SMTP.
Homepage - https://preactjs.com/
Preact CLI Documentation- https://github.com/preactjs/preact-cli#cli-options
_________________________________________________________________________________________
Server - Os: Rocky Linux 8.5 64Bit | IP -192.168.1.60 |Hostname - server.yourdomain.com
_________________________________________________________________________________________
cat /etc/system-release ; hostname -I ; sestatus ; dnf groupinstall "Development Tools" -y ; dnf module enable nodejs:14 -y ; dnf install nodejs @nginx npm -y
npx preact-cli create default my-project
cd my-project ; npm run dev
npm run build
http://127.0.0.1:8080
cat << EOF > /lib/systemd/system/Preact.service
[Unit]
After=network.target
[Service]
Type=simple
User=root
WorkingDirectory=/root/my-project
ExecStart=/usr/bin/npm run dev
Restart=on-failure
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload ; systemctl start Preact; systemctl enable Preact ; systemctl status Preact
nano /etc/nginx/conf.d/example.com.conf
server {
listen 80;
server_name www.example.com;
location / {
proxy_set_header HOST $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:8080;
}
}
firewall-cmd --permanent --add-service={http,https} ; firewall-cmd --reload ; echo "192.168.1.60 www.example.com" >> /etc/hosts
systemctl restart nginx ; systemctl status nginx
www.example.com
_________________________________________________________________________________________
Friday, February 4, 2022
How To Deploy Preact JS Preact-cli with Nginx On Rocky Linux 8.5
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment