I want to run PHP and Node.js in Azure Web app.
There are my wwwroot directory my wwwroot directory
I only can access node.js script, how can i access php and node.js script as following URL?
I want to access :
index.html
by http://www.example.com
hello.php
by http://www.example.com/phpscript/hello.php
chatroom.html
by http://www.example.com/nodejsscript/chatroom.html
And the web.config file as follow
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="iisnode" path="server.js" verb="*" modules="iisnode" />
</handlers>
<rewrite>
<rules>
<clear />
<rule name="StaticContent">
<action type="Rewrite" url="public{REQUEST_URI}"/>
</rule>
<rule name="app" enabled="true" patternSyntax="ECMAScript" stopProcessing="true">
<match url="iisnode.+" negate="true" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Rewrite" url="/nodejsscript/server.js" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Basically, you can leverage Virtual applications and directories to achieve your requirement.
1) Create virtual directories as below in the Azure portal .
2) Move web.config
file from /wwwroot
folder to /wwwroot/nodejsscript
folder, and change the following line:
<action type="Rewrite" url="/nodejsscript/server.js" />
as below:
<action type="Rewrite" url="server.js" />
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.