How to Deploy AdonisJS in Azure Web App?

#1

I need a help,
I could not run the Adonijs in AZURE web app.
Can anyone help me?
Simply does not work and displays a message
“You do not have permission to view this directory or page.”

0 Likes

#2

Hi
Did you deploy to Azure?
I’m trying to do using Pipeline, but without success, the .env file I’m not able to create through ssh.

0 Likes

#3

Hey,
Does Azure support NodeJS?
If so, the you should ask your provider and ask them the permission for deployment.
I also recommend you to use docker before any deployment just to make sure that everything is running perfectly and and you try to deploy it.:hugs:

0 Likes

#4

Hey. I was able to run it just by adding the web.config file to the project root. Within the server rules file, my server Nodejs, in my case server.js

Configure CORS in Azure as *
In Configurations add Applications Settings: WEBSITE_NODE_DEFAULT_VERSION -> 8.9.0

<configuration>
  <system.webServer>
    <webSocket enabled="false" />
    <handlers>
      <!-- Indicates that the server.js file is a node.js site to be handled by the iisnode module -->
      <add name="iisnode" path="server.js" verb="*" modules="iisnode"/>
    </handlers>
    <rewrite>
      <rules>
        <!-- Do not interfere with requests for node-inspector debugging -->
        <rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true">
          <match url="^server.js\/debug[\/]?" />
        </rule>

        <!-- All other URLs are mapped to the node.js site entry point -->
        <rule name="API Routes">
          <match url="^api\/.*" />
          <action type="Rewrite" url="server.js"/>
        </rule>

        <!-- React Routes -->
        <rule name="React Routes" stopProcessing="true">
          <match url=".*" />
          <conditions logicalGrouping="MatchAll">
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
            <add input="{REQUEST_URI}" pattern="^/(api)" negate="true" />
          </conditions>
          <action type="Rewrite" url="/" />
        </rule>
      </rules>
    </rewrite>

    <!-- 'bin' directory has no special meaning in node.js and apps can be placed in it -->
    <security>
      <requestFiltering>
        <hiddenSegments>
          <remove segment="bin"/>
        </hiddenSegments>
      </requestFiltering>
    </security>

    <!-- Make sure error responses are left untouched -->
    <httpErrors existingResponse="PassThrough" />

    <!--
      You can control how Node is hosted within IIS using the following options:
        * watchedFiles: semi-colon separated list of files that will be watched for changes to restart the server
        * node_env: will be propagated to node as NODE_ENV environment variable
        * debuggingEnabled - controls whether the built-in debugger is enabled

      See https://github.com/tjanczuk/iisnode/blob/master/src/samples/configuration/web.config for a full list of options
    -->
    <!--<iisnode watchedFiles="web.config;*.js"/>-->
  </system.webServer>
</configuration>
1 Like