Https Nest js is not running properly but http works as expected

Viewed 66

I have deployed Nest Js application in the centos server with cpanel. while browsing with http://siteurl its running as expected but while browsing with https://siteurl it prints Index of / file list of application.

I have added https options as below :

 import { readFileSync } from 'fs';
 async function bootstrap() {
  const httpsOptions = {
         key:readFileSync('/path/to/key/keyfilename.key'),
         cert: readFileSync('/path/to/cert/certfilename.key'),
 };

 const app = await NestFactory.create(AppModule, {
             httpsOptions
         });
   await app.listen(7000);
   }
0 Answers
Related