Express.js is a minimal and flexible Node.js framework that gives you the power to write web applications.
Homepage - https://expressjs.com/
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 ; dnf groupinstall "Development Tools" -y
dnf module enable nodejs:14 -y ; dnf install nodejs npm httpd -y
npm init
npm install express
npm install express-generator -g
npm list express
express -v ejs mynewsite
cd mynewsite && npm install
DEBUG=mynewsite:* npm start
http://127.0.0.1:3000
nano /lib/systemd/system/express.service
[Unit]
After=network.target
[Service]
Type=simple
User=root
WorkingDirectory=/root/mynewsite
ExecStart=/usr/bin/npm start
Restart=on-failure
[Install]
WantedBy=multi-user.target
systemctl daemon-reload ; systemctl start express ; systemctl enable express ; systemctl status express
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://localhost:3000/
ProxyPassReverse / http://localhost:3000/
</VirtualHost>
apachectl configtest
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
---------------------------------------------------------------------------------------------------------------------------------------------------------
Friday, February 4, 2022
How To install Express.js With Apache Proxy On Rocky Linux 8.5
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment