Monday, March 2, 2015

IIS, NodeJS, IISNode, PhantomJS

Step by Step installing NodeJS and PhantomJS on IIS using IISNode

  1. Download: latest NodeJS, IISNode, and PhantomJS for windows.
  2. On the server, make sure IIS is activated from Windows Feature. If it is not activated, please activate first.
    Windows Feature - Internet Information Service - Web Management Tools - IIS 6 Management Tools
    More details see here
  3. Install NodeJS
    No need to check anything after install. In here I use the default installation folder which is in C:\Program Files (x86)\nodejs
  4. Install IISNode
    Similar with nodejs, IISNode is installed in the default folder.
    After install IISNode, need to do several steps below:
    • check iisnode folder after installation
    • inside the installation folder, it will contains several files as well a www folder. Add IIS_IUSRS to www folder security. Assign Read and Write permission. To make it simple I give Full Control access.
    • Create 1 website in IIS for IISNode, where the physical path is the www folder.
    • run setupsamples.bat
    • once success, go to the site that we setup to check is the iisnode configuration already correct.
    • on www folder, there are several folders and in each folder exist 1 web.config file. In this case, I only want to test the iisnode installation. Therefore, in helloworld folder, I modify the web.config to include the iisnode configuration below.
       <iisnode     
          node_env="%node_env%"  
          nodeProcessCountPerApplication="1"  
          maxConcurrentRequestsPerProcess="1024"  
          maxNamedPipeConnectionRetry="100"  
          namedPipeConnectionRetryDelay="250"     
          maxNamedPipeConnectionPoolSize="512"  
          maxNamedPipePooledConnectionAge="30000"  
          asyncCompletionThreadCount="0"  
          initialRequestBufferSize="4096"  
          maxRequestBufferSize="65536"  
          watchedFiles="*.js;iisnode.yml"  
          uncFileChangesPollingInterval="5000"     
          gracefulShutdownTimeout="60000"  
          loggingEnabled="true"  
          logDirectory="iisnode"  
          debuggingEnabled="true"  
          debugHeaderEnabled="false"  
          debuggerPortRange="5058-6058"  
          debuggerPathSegment="debug"  
          maxLogFileSizeInKB="128"  
          maxTotalLogFileSizeInKB="1024"  
          maxLogFiles="20"  
          devErrorsEnabled="true"  
          flushResponse="false"     
          enableXFF="false"  
          promoteServerVars=""  
          configOverrides="iisnode.yml"  
             nodeProcessCommandLine="C:\Program Files (x86)\nodejs\node.exe"  
          />  
      
    • We use nodeProcessCommandLine to specify the nodejs executable url.
    • Save the web.config and check whether helloworld.js already opened ok in browser without any error in page.
  5. After IISNode is working, extract PhantomJS to a folder.
    I extracted PhantomJS zip to C:\phantom
    • Need to add C:\phantom\bin (phantom.exe location) to windows PATH.
      Run in windows command prompt: setx path "%path%;C:\phantom\bin"
    • test by running : phantomjs --version into command prompt
      If it is showing the version then phantom is installed.
      If showing, phantom is not recognized then the server should be restarted.
    • After restart, check again the phantom version in command prompt

No comments:

Post a Comment