1"use strict";(globalThis.webpackChunk_verdaccio_website=globalThis.webpackChunk_verdaccio_website||[]).push([[7157],{81821:(e,r,s)=>{s.r(r),s.d(r,{assets:()=>d,contentTitle:()=>o,default:()=>h,frontMatter:()=>t,metadata:()=>n,toc:()=>a});const n=JSON.parse('{"id":"ssl","title":"Set up the SSL Certificates","description":"Serve the registry over HTTPS, either with Verdaccio own certificates or from behind a proxy.","source":"@site/docs/ssl.md","sourceDirName":".","slug":"/ssl","permalink":"/docs/ssl","draft":false,"unlisted":false,"editUrl":"https://github.com/verdaccio/website/edit/master/website/docs/ssl.md","tags":[],"version":"current","lastUpdatedBy":"Jotadeveloper","lastUpdatedAt":1790630475000,"frontMatter":{"id":"ssl","title":"Set up the SSL Certificates","description":"Serve the registry over HTTPS, either with Verdaccio own certificates or from behind a proxy."},"sidebar":"docs","previous":{"title":"Reverse Proxy Setup","permalink":"/docs/reverse-proxy"},"next":{"title":"Installing As a Windows Service","permalink":"/docs/windows"}}');var i=s(8265),c=s(92233);const t={id:"ssl",title:"Set up the SSL Certificates",description:"Serve the registry over HTTPS, either with Verdaccio own certificates or from behind a proxy."},o=void 0,d={},a=[{value:"Docker",id:"docker",level:2}];function l(e){const r={a:"a",code:"code",h2:"h2",li:"li",p:"p",pre:"pre",ul:"ul",...(0,c.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(r.p,{children:"Follow these instructions to configure an SSL certificate to serve an npm registry over HTTPS."}),"\n",(0,i.jsxs)(r.ul,{children:["\n",(0,i.jsxs)(r.li,{children:["Update the listen property in your ",(0,i.jsx)(r.code,{children:"~/.config/verdaccio/config.yaml"}),":"]}),"\n"]}),"\n",(0,i.jsx)(r.pre,{children:(0,i.jsx)(r.code,{children:"listen: 'https://your.domain.com/'\n"})}),"\n",(0,i.jsx)(r.p,{children:"Once you've updated the listen property and try to run verdaccio again, it will ask for certificates."}),"\n",(0,i.jsxs)(r.ul,{children:["\n",(0,i.jsx)(r.li,{children:"Generate your certificates"}),"\n"]}),"\n",(0,i.jsx)(r.pre,{children:(0,i.jsx)(r.code,{children:" $ openssl genrsa -out /Users/user/.config/verdaccio/verdaccio-key.pem 2048\n $ openssl req -new -sha256 -key /Users/user/.config/verdaccio/verdaccio-key.pem -out /Users/user/.config/verdaccio/verdaccio-csr.pem\n $ openssl x509 -req -in /Users/user/.config/verdaccio/verdaccio-csr.pem -signkey /Users/user/.config/verdaccio/verdaccio-key.pem -out /Users/user/.config/verdaccio/verdaccio-cert.pem\n"})}),"\n",(0,i.jsxs)(r.ul,{children:["\n",(0,i.jsxs)(r.li,{children:["Edit your config file ",(0,i.jsx)(r.code,{children:"/Users/user/.config/verdaccio/config.yaml"})," and add the following section:"]}),"\n"]}),"\n",(0,i.jsx)(r.pre,{children:(0,i.jsx)(r.code,{children:"https:\n key: /Users/user/.config/verdaccio/verdaccio-key.pem\n cert: /Users/user/.config/verdaccio/verdaccio-cert.pem\n ca: /Users/user/.config/verdaccio/verdaccio-csr.pem\n"})}),"\n",(0,i.jsxs)(r.p,{children:["Alternatively, if you have a certificate with the ",(0,i.jsx)(r.code,{children:"server.pfx"})," format, you can add the following configuration section: (The passphrase is optional and only needed if your certificate is encrypted.)"]}),"\n",(0,i.jsx)(r.pre,{children:(0,i.jsx)(r.code,{children:"https:\n pfx: /Users/user/.config/verdaccio/server.pfx\n passphrase: 'secret'\n"})}),"\n",(0,i.jsxs)(r.p,{children:["You can find more info on the ",(0,i.jsx)(r.code,{children:"key"}),", ",(0,i.jsx)(r.code,{children:"cert"}),", ",(0,i.jsx)(r.code,{children:"ca"}),", ",(0,i.jsx)(r.code,{children:"pfx"}),", and ",(0,i.jsx)(r.code,{children:"passphrase"})," arguments in the ",(0,i.jsx)(r.a,{href:"https://nodejs.org/api/tls.html#tls_tls_createsecurecontext_options",children:"Node documentation"})]}),"\n",(0,i.jsxs)(r.ul,{children:["\n",(0,i.jsxs)(r.li,{children:["\n",(0,i.jsxs)(r.p,{children:["Run ",(0,i.jsx)(r.code,{children:"verdaccio"})," in your command line."]}),"\n"]}),"\n",(0,i.jsxs)(r.li,{children:["\n",(0,i.jsxs)(r.p,{children:["Open the browser and visit ",(0,i.jsx)(r.code,{children:"https://your.domain.com:port/"})]}),"\n"]}),"\n"]}),"\n",(0,i.jsx)(r.p,{children:"These instructions are mostly valid under OSX and Linux; on Windows the paths will vary, but the steps are the same."}),"\n",(0,i.jsx)(r.h2,{id:"docker",children:"Docker"}),"\n",(0,i.jsxs)(r.p,{children:["If you are using the Docker image, you have to set the ",(0,i.jsx)(r.code,{children:"VERDACCIO_PROTOCOL"})," environment variable to ",(0,i.jsx)(r.code,{children:"https"}),", as the ",(0,i.jsx)(r.code,{children:"listen"})," argument is provided by the image's ",(0,i.jsx)(r.a,{href:"https://github.com/verdaccio/verdaccio/blob/master/Dockerfile",children:(0,i.jsx)(r.code,{children:"CMD"})})," and thus overrides the ",(0,i.jsx)(r.code,{children:"listen"})," entry of your config file."]}),"\n",(0,i.jsxs)(r.p,{children:["You can also set the ",(0,i.jsx)(r.code,{children:"VERDACCIO_PORT"})," environment variable if you are using a port other than ",(0,i.jsx)(r.code,{children:"4873"}),"."]})]})}function h(e={}){const{wrapper:r}={...(0,c.R)(),...e.components};return r?(0,i.jsx)(r,{...e,children:(0,i.jsx)(l,{...e})}):l(e)}},92233:(e,r,s)=>{s.d(r,{R:()=>t,x:()=>o});var n=s(70141);const i={},c=n.createContext(i);function t(e){const r=n.useContext(c);return n.useMemo(function(){return"function"==typeof e?e(r):{...r,...e}},[r,e])}function o(e){let r;return r=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:t(e.components),n.createElement(c.Provider,{value:r},e.children)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.