2015-11-23 21 views
6

Używam węzła w połączeniu z IIS przy użyciu iisnode.HTTPS i iisnode

Wydaje mi się, że rzeczy, które wcześniej robiłem w węźle w celu skonfigurowania serwera, można teraz wykonywać bezpośrednio w usługach IIS.

miejsca jak:

  • https konfiguracji (i certyfikatami)
  • http na https przekierowania

Czy to znaczy mogę pozbyć kodu węzła, który to zrobił i przejść dla metoda IIS?

var fs = require('fs'); 
var https = require('https'); 

var options = { 
    key: fs.readFileSync('./ssl/xxxxxxx.private.pem'), 
    cert: fs.readFileSync('./ssl/xxxxxxx.public.pem'), 
}; 

https.createServer(options, app).listen(443); 

Odpowiedz

3

Tak. Powinieneś wykonać całą konfigurację ssl w IIS i Windows.

To jest to, czego użyłem przy produkcji.

zastosowania, po prostu pisząc

var app = express(); 
app.listen(process.env.port); 

Następnie Web.config iisnode

<configuration> 
    <system.webServer> 

    <handlers> 
     <add name="iisnode" path="app.js" verb="*" modules="iisnode" /> 
    </handlers> 


<rewrite> 
    <rules> 
    <rule name="HTTP to Prod HTTPS redirect" stopProcessing="true"> 
     <match url="(.*)" /> 
     <conditions> 
     <add input="{HTTPS}" pattern="off" ignoreCase="true" /> 
     </conditions> 
     <action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" /> 
    </rule> 
    <!-- Don't interfere with requests for logs --> 
    <rule name="LogFile" patternSyntax="ECMAScript" stopProcessing="true"> 
     <match url="^[a-zA-Z0-9_\-]+\.js\.logs\/\d+\.txt$" /> 
    </rule> 
    <!-- Don't interfere with requests for node-inspector debugging --> 
    <rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true"> 
     <match url="^app.js\/debug[\/]?" /> 
    </rule> 
    <!-- First we consider whether the incoming URL matches a physical file in the  /public folder --> 
    <rule name="StaticContent"> 
     <action type="Rewrite" url="public{REQUEST_URI}" /> 
    </rule> 
    <!-- All other URLs are mapped to the Node.js application entry point --> 
    <rule name="DynamicContent"> 
     <conditions> 
     <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True" /> 
     </conditions> 
     <action type="Rewrite" url="app.js" /> 
    </rule> 
    </rules> 
</rewrite> 

    </system.webServer> 
</configuration> 
Powiązane problemy