1
0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-11-17 07:45:52 +01:00
verdaccio/website/translated_docs/zh-Hans/server.md
verdacciobot e9660ef656 New Crowdin translations (#839)
* New translations dev-plugins.md (Spanish)
docs(website): new translations

* New translations en.json (Portuguese, Brazilian)
docs(website): new translations

* New translations web.md (Portuguese, Brazilian)
docs(website): new translations

* New translations install.md (Spanish)
docs(website): new translations

* New translations en.json (Spanish)
docs(website): new translations

* New translations plugins.md (Spanish)
docs(website): new translations

* New translations web.md (Spanish)
docs(website): new translations

* New translations plugins.md (Portuguese, Brazilian)
docs(website): new translations

* New translations dev-plugins.md (Chinese Simplified)
docs(website): new translations

* New translations plugins.md (Chinese Simplified)
docs(website): new translations

* New translations install.md (Chinese Simplified)
docs(website): new translations

* New translations install.md (Portuguese, Brazilian)
docs(website): new translations

* New translations dev-plugins.md (Portuguese, Brazilian)
docs(website): new translations

* New translations en.json (Chinese Simplified)
docs(website): new translations

* New translations web.md (Chinese Simplified)
docs(website): new translations

* New translations protect-your-dependencies.md (Chinese Simplified)
docs(website): new translations

* New translations protect-your-dependencies.md (Chinese Simplified)
docs(website): new translations

* New translations protect-your-dependencies.md (Chinese Simplified)
docs(website): new translations

* New translations repositories.md (Chinese Simplified)
docs(website): new translations

* New translations reverse-proxy.md (Chinese Simplified)
docs(website): new translations

* New translations reverse-proxy.md (Chinese Simplified)
docs(website): new translations

* New translations reverse-proxy.md (Chinese Simplified)
docs(website): new translations

* New translations server.md (Chinese Simplified)
docs(website): new translations

* New translations server.md (Chinese Simplified)
docs(website): new translations

* New translations server.md (Chinese Simplified)
docs(website): new translations

* New translations server.md (Chinese Simplified)
docs(website): new translations

* New translations ssl.md (Chinese Simplified)
docs(website): new translations

* New translations ssl.md (Chinese Simplified)
docs(website): new translations

* New translations protect-your-dependencies.md (Chinese Simplified)
docs(website): new translations

* New translations ssl.md (Chinese Simplified)
docs(website): new translations

* New translations protect-your-dependencies.md (Chinese Simplified)
docs(website): new translations

* New translations repositories.md (Chinese Simplified)
docs(website): new translations

* New translations reverse-proxy.md (Chinese Simplified)
docs(website): new translations

* New translations reverse-proxy.md (Chinese Simplified)
docs(website): new translations

* New translations server.md (Chinese Simplified)
docs(website): new translations

* New translations ssl.md (Chinese Simplified)
docs(website): new translations

* New translations protect-your-dependencies.md (Chinese Simplified)
docs(website): new translations

* New translations reverse-proxy.md (Chinese Simplified)
docs(website): new translations
2018-07-25 07:56:23 +02:00

73 lines
2.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
id: server-configuration服务器-配置)
title: "服务器配置"
---
这主要是一些基础的linux服务器配置信息但是我觉得很重要来记录并分享我让verdaccio 在服务器上永久运行的步骤。 您将需要以下的根或者sudo权限。
## 作为单独用户运行
首先创建verdaccio 用户:
```bash
$ sudo adduser --disabled-login --gecos 'Verdaccio NPM mirror' verdaccio
```
您用以下命令来创建一个 shell作为verdaccio用户:
```bash
$ sudo su verdaccio
$ cd ~
```
'cd ~' 命令把您送到verdaccio用户的主目录。请确保您至少运行一次verdaccio来生成config文件。根据您的需求来编辑它。
## 监听所有地址
如果您希望监听每个外部地址请把config里的监听指令设置为:
```yaml
# you can specify listen address (or simply a port)
listen: 0.0.0.0:4873
```
如果您在Amazon EC2 Instance运行 `verdaccio`, 如上所述,[您将需要设置监听config 文件](https://github.com/verdaccio/verdaccio/issues/314#issuecomment-327852203) 。
> Apache configure? 请查看[逆向代理服务器配置](reverse-proxy.md)
## 让 verdaccio一直运行下去
我们可以使用名为'forever永远的节点包来让verdaccio一直运行下去。 https://github.com/nodejitsu/forever
首先安装全局forever
```bash
$ sudo npm install -g forever
```
请确保您至少已经启动一次verdaccio来生成config 文件并记录下创建的管理员用户。然后您可以用以下命令来启动verdaccio:
```bash
$ forever start `which verdaccio`
```
您可以查看文档来了解更多关于如何使用forever的信息。
## 存留服务器重启
我们可以在服务器重启后同时用crontab和forever来重启 verdaccio。当您以 verdaccio 用户登录后请执行以下操作:
```bash
$ crontab -e
```
这可能会要您选择一个编辑器。请挑选您最喜欢的并继续。请将以下条目添加到文件中:
@reboot /usr/bin/forever start /usr/lib/node_modules/verdaccio/bin/verdaccio
取决于服务器的设置,位置可能会有所不同。如果您想知道文件的位置,可以使用 'which' 命令:
```bash
$ which forever
$ which verdaccio
```