TOP

Martin Carr.com

Node JS

Node JS

// NODE

yum install -y epel-relase
            
npm install express
npm install nodemon
npm install mongodb
            
npm init
"watch": "nodemon",	// under scripts
            
pkill node
            
node server &	// to keep server running!       
            
// NGINX
            
install nginx      
sudo yum update
            
// PHP
            
# yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
# yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
            
# yum install yum-utils
# yum-config-manager --enable remi-php73
# yum install php php-mcrypt php-cli php-gd php-curl php-mysql php-ldap php-zip php-fileinfo 
            
systemctl restart php-fpm
            
yum install php-xml php-simplexml  // 2 hrs!!
yum install php-pecl-zip
            
                <VirtualHost *:80>
                ServerName www.carr22.co.uk
                ServerAlias carr22.co.uk
                DocumentRoot /home/carr22/node
                ErrorLog  /home/carr22/node/log/error.log
                CustomLog /home/carr22/node/log/requests.log combined
                </VirtualHost>
            
ln -s /etc/httpd/sites-available/site-1.co.uk.conf /etc/httpd/sites-enabled/site-1.co.uk.conf
ln -s /etc/httpd/sites-available/site-2.com.conf /etc/httpd/sites-enabled/site-2.com.conf
ln -s /etc/httpd/sites-available/site-3.co.uk.conf /etc/httpd/sites-enabled/site-3.co.uk.conf
            
chown -R $USER:$USER /home/carr22/node
hmod -R 777 /home/carr22/node
               
ProxyRequests on
ProxyPass /todo http://localhost:4000/todo
            
chkconfig httpd on
service --status-all
apt-get install php libapache2-mod-php
systemctl restart apache2
            
apt-get install php-pear php7.2-curl php7.2-dev php7.2-gd php7.2-mbstring php7.2-zip php7.2-xml php7.2-mysql
            
a2enmod rewrite
a2ensite martincarr.com.conf
a2ensite katiecarr.co.uk.conf
a2ensite carr22.co.uk.conf
            
sudo a2enmod proxy
sudo a2enmod proxy_http
sudo a2enmod proxy_balancer
sudo a2enmod lbmethod_byrequests
sudo a2enmod rewrite
            
                    <Directory /var/www/html>
                    Options Indexes FollowSymLinks MultiViews
                    AllowOverride All
                    Require all granted
                    </Directory>
            
apt-get install unzip
            
cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/website.com.conf
                   
//////////////// NODE JS ////////////////////
            
NPM
apt install nodejs
apt install npm
npm install
npm install ejs
npm run watch
npm install pm2 -g
pm2 startup  (pm2 unstartup systemd  // to remove)
pm2 start server.js
pm2 save
pm2 stop 1
npm install	// gets dependencies
pkill node