in This Tutorial you will Learn " How To Deploy Node.js Application With Apache Web Server in Rocky Linux 8"
Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.
NPM – or "Node Package Manager" – is the default package manager for JavaScript's runtime Node.js
Apache is the most widely used web server software.
_________________________________________________________________________________________
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
curl -fsSL https://rpm.nodesource.com/setup_16.x | sudo -E bash -
dnf install nodejs -y ; npm --version ; node --version
Create a Sample Node.js Application -
mkdir project ; cd project
nano first.js
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Welcome to Node.js Server');
}).listen(8080, "127.0.0.1");
console.log('Server running at http://127.0.0.1:8080/');
npm install pm2@latest -g
pm2 start first.js | pm2 stop first.js
pm2 startup
netstat -tlpn
dnf update ; dnf install httpd -y
nano /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://127.0.0.1:8080/
ProxyPassReverse / http://127.0.0.1:8080/
</VirtualHost>
firewall-cmd --permanent --add-service={http,https} ; firewall-cmd --reload
systemctl daemon-reload ; systemctl start httpd ; systemctl enable httpd
echo "192.168.1.60 www.example.com" >> /etc/hosts
http://www.example.com
_________________________________________________________________________________________
Wednesday, February 9, 2022
How To Deploy Node.js Application With Apache in Rocky Linux 8
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment