Giter Site home page Giter Site logo

npomf-modify's Introduction

NotPomf

NodeJS rewrite of nokonoko/Pomf.

Install

For the purposes of this guide, we won't cover setting up Nginx, Node, or NPM. So we'll just assume you already have them all running well.

Setting Up

Assuming you already have Node and NPM working, setting up npomf is easy:

$ git clone https://github.com/maxpowa/npomf.git  
$ cd npomf  
$ npm install  

That's it. You can now run the app with npm start

Docker

docker pull maxpowa/npomf

Start the container as you would normally.

Configuring npomf

In the config folder, you will find all of the files that effect the operation of the application. Most config options should be self-explanatory or will have extensive documentation on them.

Docker

For configuring in docker, you can specify environment variables to overwrite the existing config by adding NPOMF_<CONFIG_VALUE> to your env. You can also create a volume over the config file with

-v <path/to/your/core.js>:/usr/src/app/config/core.js

Nginx Config

Usually, you want to run a NodeJS app behind a proxy like nginx. Configuring nginx with npomf is easy.

# Point the 'server' option here to your npomf instance
upstream npomf {
  server 127.0.0.1:3000;
  keepalive 128;
}

# This defines the vhost, configure based on your setup
server {
  listen       80;
  server_name  my.public.server;

  location / {
    proxy_pass http://npomf/;
    proxy_redirect off;

    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-NginX-Proxy true;
  }

}

For SSL support, add another server block after the previous one containing the following.

server {
  listen       443;
  server_name  my.public.server;

  # If you're worried about SSL you should know to point the
  # 'ssl_certificate' and 'ssl_certificate_key' to your own
  # locations
  ssl_certificate      /etc/nginx/ssl/server.crt;
  ssl_certificate_key  /etc/nginx/ssl/server.key;

  location / {
    proxy_pass http://npomf/;
    proxy_redirect off;

    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-NginX-Proxy true;
  }
}

In production, nginx should handle serving uploaded files. Depending on your configuration, your nginx config might look different. The example given below is a stripped down version of aww.moe's configuration. You may want to consider adding CSP headers, gzip compression or expiration headers along with the charset.

upstream npomf {
  server 127.0.0.1:3000;
  keepalive 128;
}
server {
  listen 80;
  listen [::]:80 ipv6only=on;

  server_name your.site;

  location / {
    root /path/to/npomf/files;
    try_files $uri @npomf;

    charset UTF-8;
  }

  location @npomf {
    proxy_pass http://npomf/;
    proxy_redirect off;

    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-NginX-Proxy true;
  }
}

In the nginx main config, you'll have to change the client_max_body_size in order to allow uploads larger than 1MB. You should change it to whatever you choose as the max upload size in the config file.

http {
  ...
  client_max_body_size 100m;
  ...
}

npomf-modify's People

Contributors

maxpowa avatar rx14 avatar aareksio avatar finnoleary avatar tayuo 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.