Friday, February 4, 2022

How To Deploy Preact JS Preact-cli with Apache On Rocky Linux 8.5

 in This Tutorial you will Learn " How To Deploy Preact JS Preact-cli with Apache 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!

Apache is the most widely used web server software.

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 httpd 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
cat << EOF > /etc/httpd/conf.d/example.conf
<VirtualHost *:80>
        ServerAdmin admin@example.com
        ServerName www.example.com    
        ErrorLog /var/log/httpd/error.log
        CustomLog /var/log/httpd/access.log combined
        ProxyRequests On
        ProxyPass / http://localhost:8080/
        ProxyPassReverse / http://localhost:8080/
</VirtualHost>
EOF
systemctl daemon-reload ; systemctl start httpd ; systemctl enable httpd ; systemctl status httpd
echo "192.168.1.60 www.example.com" >> /etc/hosts : firewall-cmd --permanent --add-service={http,https} ; firewall-cmd --reload

www.example.com
_________________________________________________________________________________________


No comments:

Post a Comment