Storyblok Raises $80M Series C - Read News

What’s the True Total Price of Enterprise CMS? Find out here.

Skip to main content

How to run Nuxt2 with HTTPS in Windows

  • FAQ
  • How to run Nuxt2 with HTTPS in Windows

Using Nuxt2 and version 3 of Nuxt with Storyblok would require HTTPS for development.

To serve Nuxt2 with HTTPS, follow the steps below.

  • Navigate to your project's main directory
  • Create a public and private key as shown in the code block below
    keys
            
          openssl genrsa 2048 > server.key
    chmod 400 server.key
    openssl req -new -x509 -nodes -sha256 -days 365 -key server.key -out server.crt
        
  • Add your server requirements to your nuxt.config.js file
    nuxt.config.js
            
          import path from 'path'
    import fs from 'fs'
        
  • Add your server configuration to your nuxt.config.js file
    nuxt.config.js
            
           server: {
        https: {
          key: fs.readFileSync(path.resolve(__dirname, 'server.key')),
          cert: fs.readFileSync(path.resolve(__dirname, 'server.crt'))
        }
      }
        

HINT:

If you're a macOS user, you should check out the setup for HTTPS on MacOS.