2017-04-07 2 views
0

Azure WebアプリケーションでPHPとNode.jsを実行します。PHP、node.jsでAzure Webアプリケーションを作成する

私のwwwrootディレクトリが my wwwroot directory

あります私は、私はPHPにアクセスして、URLを次のようにスクリプトをNode.jsのことができますどのように、Node.jsのスクリプトにアクセスすることができますか?

私がアクセスしたい:
index.htmlhttp://www.example.com
hello.phpによってhttp://www.example.com/phpscript/hello.php
chatroom.htmlによってhttp://www.example.com/nodejsscript/chatroom.html


そして、web.configファイルで基本的に

<?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> 
+0

エラーは何ですか? – hassan

+0

http:// www.example.com/phpscript/hello.phpにアクセスすると、HTTPエラー500が表示されます –

+0

[Node.js Webサーバー内でPHPスクリプトを実行する]の可能性があります(http:// stackoverflow。 com/questions/6542169/execute-php-scripts-within-node-js-web-server) – Martin

答えて

0

に従うように、あなたができますレバレッジ仮想アプリケーションとディレクトリあなたの要件を達成する。

1)Azure portalに仮想ディレクトリを作成します。

enter image description here

2)/wwwroot/nodejsscriptフォルダへ/wwwrootフォルダからweb.configファイルを移動し、次の行を変更します。以下のように

<action type="Rewrite" url="/nodejsscript/server.js" /> 

を:

<action type="Rewrite" url="server.js" /> 
関連する問題