mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-12-16 21:56:25 -05:00
docs: update docs with behind reverse proxy
This commit is contained in:
parent
f21c3f0b26
commit
733f13528d
1 changed files with 28 additions and 12 deletions
40
SERVER.md
40
SERVER.md
|
@ -22,19 +22,35 @@ listen: 0.0.0.0:4873
|
||||||
```
|
```
|
||||||
|
|
||||||
## Run behind reverse proxy with different domain and port
|
## Run behind reverse proxy with different domain and port
|
||||||
If you run verdaccio behind reverse proxy, you may noticed all resource file served as relaticve path, like `http://127.0.0.1:4873/-/static`, you can resolve this by set `url_prefix`
|
If you run verdaccio behind reverse proxy, you may noticed all resource file served as relaticve path, like `http://127.0.0.1:4873/-/static`
|
||||||
```yaml
|
|
||||||
url_prefix: 'https://your-domain:8888'
|
|
||||||
# or
|
|
||||||
url_prefix: 'https://your-domain:8888/your-path'
|
|
||||||
```
|
|
||||||
|
|
||||||
If you do not know the protocol and host, you can define only subpath as `url_prefix`. Full URL will be constructed from the request.
|
To resolve this issue, you should send real domain and port to verdaccio with `Host` heade
|
||||||
```yaml
|
|
||||||
url_prefix: '/your-path'
|
|
||||||
```
|
|
||||||
|
|
||||||
> Nginx or Apache configure? Please check out Wiki ;-)
|
Nginx configure should look like this:
|
||||||
|
```nginx
|
||||||
|
location / {
|
||||||
|
proxy_pass http://127.0.0.1:4873/;
|
||||||
|
proxy_set_header Host $host:$server_port;
|
||||||
|
proxy_set_header X-Forwarded-For $remote_addr;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
For this case, `url_prefix` should NOT set in verdaccio config
|
||||||
|
|
||||||
|
---
|
||||||
|
or a sub-directory installation:
|
||||||
|
```nginx
|
||||||
|
location ~ ^/verdaccio/(.*)$ {
|
||||||
|
proxy_pass http://127.0.0.1:4873/$1;
|
||||||
|
proxy_set_header Host $host:$server_port;
|
||||||
|
proxy_set_header X-Forwarded-For $remote_addr;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
For this case, `url_prefix` should set to `/verdaccio/`
|
||||||
|
|
||||||
|
> Note: There is a Slash after install path (`https://your-domain:port/vardaccio/`)!
|
||||||
|
|
||||||
|
|
||||||
|
> Apache configure? Please check out Wiki ;-)
|
||||||
|
|
||||||
## Keeping verdaccio running forever
|
## Keeping verdaccio running forever
|
||||||
We can use the node package called 'forever' to keep verdaccio running all the time.
|
We can use the node package called 'forever' to keep verdaccio running all the time.
|
||||||
|
@ -93,4 +109,4 @@ Apache virtual server configuration
|
||||||
ProxyPassReverse / http://127.0.0.1:4873/
|
ProxyPassReverse / http://127.0.0.1:4873/
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
</IfModule>
|
</IfModule>
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in a new issue