Giter Club home page Giter Club logo

leafii_bravo's Introduction

Leafolio

Leafolio is a node app that conveniently serves many different websites at the same time on a single server.

Prereq

If you are running Ubuntu run the following. If not, use your own package manager:

# apt update
# apt upgrade
# apt -y install nginx socat

For npm, take it from the source (or later versions if it becomes available):

$ curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
# apt -y install nodejs
# npm install -g npm

Setup

To get started run the package manager to download the necessary modules

$ npm install

Environment Variables

To change the port and set the environment to production the server requires the following envvars

$ export PORT=80
$ export ENV=production

Production

To run the node server on background, use a node module called forever:

$ sudo npm install -g forever

Then start the node server through forever:

$ forever npm start bin/www

HTTPS with nginx ssl

ACME.sh is a free Automated Certificate Management Environment that registers certificates through Let's Encrypt Certificate Authority. To install run:

# curl https://get.acme.sh | sh

To simplify setup, we use standalone method of registering the domain to our IP. Remembering that the standalone procedure requires port 80 to be open, we simply use --httpport to specify an alternate port:

$ sudo su
# service nginx stop
# acme.sh --issue --standalone --httpport 88 -d example.com -d www.example.com
# service nginx start

for example:

# acme.sh --issue --standalone -d richtutoring.com -d www.richtutoring.com -d cminshull.com -d kimchirichie.com -d scarlettminshull.com -d sminshull.com -d money.kimchirichie.com

which will store the generated files in ~/.acme.sh/example.com/. Copy the folder into /var/www/cert/ and change permissions. Proceed to specify the cert and key paths in nginx.conf reference guides to setup nginx ssl and forward http to https. Then reload nginx server

# cp -r ~/.acme.sh/example.com /var/www/cert/
# chmod -R 660 /var/www/cert/example.com
...
    ##modify nginx.conf
...
# service nginx reload

if the setup was successful, nginx will now be using SSL (TLS) to encrypt http communications. However this environment does not renew the certificate automatically. To setup auto-renew run the acme script again

acme.sh --install-cert -d example.com
  --key-file       /var/www/cert/example.com/example.com.key
  --fullchain-file /var/www/cert/example.com/fullchain.cer
  --reloadcmd     "service nginx force-reload"

for example:

acme.sh --install-cert -d richtutoring.com -d www.richtutoring.com -d cminshull.com -d kimchirichie.com -d scarlettminshull.com -d sminshull.com -d money.kimchirichie.com
  --key-file /var/www/cert/richtutoring.com/richtutoring.com.key
  --fullchain-file /var/www/cert/richtutoring.com/fullchain.cer
  --reloadcmd "service nginx force-reload"

This will auto-renew the certificate every 60 days by default.

leafii_bravo's People

Contributors

cminch avatar kimchirichie avatar ttrzeng avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.