sh DigitalOcean片段

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh DigitalOcean片段相关的知识,希望对你有一定的参考价值。

sudo apt-get update
sudo apt-get install nginx

#default website
locale-gen en_US.UTF-8
echo LC_ALL=en_US.UTF-8 >> /etc/enviroment 
echo LANG=en_US.UTF-8 >> /etc/environment
locale-gen
sudo apt-get update
sudo apt-get install git
echo . ~/.nvm/nvm.sh >> ~/.bashrc
. ~/.bashrc
nvm install 0.12.7
# install Node.js as described in nodeondigitalocean.sh
# install nginx as described in nginxondigitalcoean.sh

npm install -g sinopia

replace /etc/nginx/sites-available/default with this content

server {
    listen 80;

    server_name example.com;

    location / {
        proxy_pass http://localhost:4873;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }
}

sudo service nginx restart

add your user from your local npm:
npm adduser --registry http://<publicip>

change the config.yml on your sinopia box

disable registration for new anon users:
max_users: -1
    
restrict access to everthing for authenticated users only:
packages:
  '@*/*':
    # scoped packages
    access: $authenticated
    publish: $authenticated

  '*':
    # allow all users (including non-authenticated users) to read and
    # publish all packages
    #
    # you can specify usernames/groupnames (depending on your auth plugin)
    # and three keywords: "$all", "$anonymous", "$authenticated"
    access: $authenticated

    # allow all known users to publish packages
    # (anyone can register by default, remember?)
    publish: $authenticated

    # if package is not available locally, proxy requests to 'npmjs' registry
    proxy: npmjs

  'prefixed-*':
    access: $authenticated
    publish: $authenticated
    
access the registry on your local machine:
npm set registry <publicip>
npm login

npm install something
npm publish something

Make your registry run forever:
npm install -g pm2
pm2 startup ubuntu

which sinopia
/root/.nvm/versions/node/v0.12.7/bin/sinopia

pm2 start /root/.nvm/versions/node/v0.12.7/bin/sinopia

以上是关于sh DigitalOcean片段的主要内容,如果未能解决你的问题,请参考以下文章

sh 简单的DigitalOcean域设置脚本

sh 默认的DigitalOcean WordPress设置脚本

sh laravel-digitalocean.bash

sh 在DigitalOcean上设置Docker Swarm多主机群集

sh 在DigitalOcean上设置Docker Swarm多主机群集

sh Flynn安装:单节点(适用于Ubuntu 14.04 x64 @ DigitalOcean droplet)