npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

nginxhost

v1.0.0

Published

automatically generate nginx-vhosts file for nodejs project.

Downloads

2

Readme

nginxhost

GitHub package.json version license

automatically generate nginx-vhosts file for nodejs project.

installation

$ npm i -g nginxhost

usage

非 nodejs 项目目录(无 package.json)

$ nginxhost
init nginxhost in ./nginxhost.json
server {
    listen 80;
    
    server_name www.myapp.com myapp.com;
    root /var/www/myapp;
    index index.html index.htm;
}

nginxhost.json:

{
    "listen": 80,
    "ssl": false,
    "sslConfig": {
        "pem": "myapp",
        "key": "myapp"
    },
    "server_name": "www.myapp.com myapp.com",
    "root": "/var/www/myapp",
    "index": "index.html index.htm",
    "locations": [],
    "staticCached": false,
    "php": false
}

nodejs 项目目录(有 package.json)

$ mkdir awesome_app && cd awesome_app
$ npm init -y
$ nginxhost
init nginxhost in ./package.json
server {
    listen 80;
    
    server_name www.awesome_app.com awesome_app.com;
    root /var/www/awesome_app;
    index index.html index.htm;
}

package.json:

{
    "name": "awesome_app",
    ...
    "nginxhost": {
        "listen": 80,
        "ssl": false,
        "sslConfig": {
            "pem": "awesome_app",
            "key": "awesome_app"
        },
        "server_name": "www.awesome_app.com awesome_app.com",
        "root": "/var/www/awesome_app",
        "index": "index.html index.htm",
        "locations": [],
        "staticCached": false,
        "php": false
    }
}

vhost

nginxhost 运行成功,会显示 nginx 虚拟机配置信息,同时保存到当前目录下的 vhost 文件中。在文件 ./nginxhost.jsonpackage.json 修改配置,重新运行 nginxhost 可重新生成新的 vhost 文件。

例如将配置字段ssl, staticCached, php都设置为 true,生成 vhost 内容如下:

server {
    listen 80;
    listen 443 ssl;
    server_name www.myapp.com myapp.com;
    root /var/www/myapp;
    index index.php Index.php index.html index.htm;
    
    ssl_certificate   cert/myapp.pem;
    ssl_certificate_key  cert/myapp.key;
    ssl_session_cache    shared:SSL:1m;
    ssl_session_timeout  5m;
    ssl_ciphers  HIGH:!aNULL:!MD5;
    ssl_prefer_server_ciphers  on;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    
    location ~ .*\.(js|css|gif|jpg|jpeg|png|woff|woff2|eot|otf|ttf)$ {
      add_header Expires "Mon, 15 Apr 2028 23:00:00 GMT";
      add_header Cache-Control "max-age=315360000";
    }
    location ~ \.php$ {
      include       fastcgi_params;
      fastcgi_pass  127.0.0.1:9000;
      fastcgi_index index.php;
    }
}

License

MIT

Copyright (c) 2019 kenblikylee