2
我使用create-react-app來開發我的React應用程序。現在我想在雲上發佈這個包。所以我做:用azure部署create-react-app
npm run build
它創造了一個build
文件夾,我初始化的回購:
git init
加入原點
git remote add origin https://mysiteonazure.com/app.git
最後提交和推送的文件。所以我能夠查看我的應用程序。當我想使用URL導航時出現問題,因此移動到:
http://mysiteonazure.com/login
沒有工作。
我到了下面的文章Deploying create-react-app on Microsoft Azure
所以我的構建有:
build-azure
|_.git
|_static
|_asset-manifest-json
|_favicon.ico
|_index.html
現在我加入web.config
build-azure
|_.git
|_static
|_asset-manifest-json
|_favicon.ico
|_index.html
|_web.config
有了:
<?xml version=」1.0"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<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>
</system.webServer>
</configuration>
但現在,當我去到主畫面:http://mypage.azurewebsite.net
我得到:
的頁面,因爲內部服務器錯誤有 出現無法顯示。
我該如何解決這個問題?或者,我如何正確發佈我的應用程序?
你可以看到捻日誌? –
你的web.config文件是什麼? –
@MichalCumpl我用'web.config'更新了我的帖子。是的,我可以訪問Kudu的日誌,你需要什麼樣的信息? – FacundoGFlores