Azure上的Yii2 Webapp无法正常工作

编程入门 行业动态 更新时间:2024-10-14 04:30:48
本文介绍了Azure上的Yii2 Webapp无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个分别基于Yii + Yii2框架构建的网站+服务应用程序.我尝试将其托管在Azure xxxxxx.azurewebsites/上.建立在Yii1上的网站运行正常.在Yii2端点上建立的服务返回404.这些服务在本地工作.

I am having a website + services app built on Yii + Yii2 framework respectively. I tried hosting it on Azure xxxxxx.azurewebsites/ . website which was built on Yii1 was working fine. Services built on Yii2 endpoint returning 404. the services are working in local.

以下是详细信息:

Local: Xampp server htdocs/ myapp/ dashboard/ ---> this the website folder (Yii) modules/ v1/ -----> here are my yii2 services and controllers.

现在,当我在本地尝试使用url时: localhost/myapp/v1/srvc/srvdetails工作正常.

Now when I try locally with url: localhost/myapp/v1/srvc/srvdetails is working fine.

当我尝试Azure URL时,即 xxxxxx.azurewebsites/v1/srvc/srvdetails 不起作用.

When I try Azure URL i.e. xxxxxx.azurewebsites/v1/srvc/srvdetails not working.

有人可以帮助我吗?

推荐答案

根据您的描述,似乎您的应用程序中有一个 .htaccess 文件隐藏了 index.php 模式.由于PHP脚本由Azure Web Apps上的IIS处理,因此您可以尝试生成具有以下内容的 web.config 文件,而不是您的 .htaccess :

According your description, it seems that you have a .htaccess file in your application to hidden index.php pattern in URL. As the PHP scripts are handled by IIS on Azure Web Apps, so you can try to generate a web.config file with following content to instead your .htaccess:

<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <directoryBrowse enabled="false" /> <rewrite> <rules> <rule name="Hide Yii Index" stopProcessing="true"> <match url="." ignoreCase="false" /> <conditions> <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" /> </conditions> <action type="Rewrite" url="index.php" appendQueryString="true" /> </rule> </rules> </rewrite> </system.webServer> </configuration>

否则,您可以为我们提供完整的应用程序结构,以进行进一步的诊断.如有任何其他疑问,请随时告诉我.

Otherwise, you can provide your complete application structure for us for further diagnosis. Any further concern, please feel free to let me know.

更多推荐

Azure上的Yii2 Webapp无法正常工作

本文发布于:2023-11-02 03:54:44,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1551298.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:无法正常   工作   Azure   Webapp

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!