Saturday, February 5, 2022

How To install Svelte ( JavaScript Framework ) With Nginx On Rocky Linux 8.5

 in This Tutorial you will Learn " How To install Svelte ( JavaScript Framework ) With Nginx On Rocky Linux 8.5"

Svelte is a front-end, open-source JavaScript framework for making interactive webpages.
Homepage -https://svelte.dev/
Github - https://github.com/sveltejs/svelte
_________________________________________________________________________________________
Server - Os:  Rocky Linux 8.5  64Bit      | IP -192.168.1.60        |Hostname - server.yourdomain.com
_________________________________________________________________________________________
cat /etc/system-release ; hostname ; hostname -I ; sestatus ; dnf groupinstall "Development Tools" -y ; dnf module enable nodejs:14 -y ; dnf install nodejs npm nginx  -y

npx degit sveltejs/template my-svelte-project
cd my-svelte-project
npm install
npm run dev
npm run build
http://localhost:8080

nano /lib/systemd/system/sveltejs.service
[Unit]
After=network.target
[Service]
Type=simple
User=root
WorkingDirectory=/root/my-svelte-project
ExecStart=/usr/bin/npm run dev
Restart=on-failure
[Install]
WantedBy=multi-user.target
systemctl daemon-reload ; systemctl start sveltejs ; systemctl enable sveltejs ; systemctl status sveltejs

nano /etc/nginx/conf.d/yourdomain.conf
server {
    listen 80;
    server_name www.yourdomain.com;

    location / {
        proxy_set_header   X-Forwarded-For $remote_addr;
        proxy_set_header   Host $http_host;
        proxy_pass         http://localhost:8080;
    }
}
systemctl restart nginx ; systemctl enable nginx ; firewall-cmd --permanent --add-service={http,https} ; firewall-cmd --reload
echo "192.168.1.60 www.yourdomain.com"  >> /etc/hosts
www.yourdomain.com
_________________________________________________________________________________________

No comments:

Post a Comment