简体   繁体   English

Centos 8 上的 Mezzio 骨架应用

[英]Mezzio skeleton application on Centos 8

I try to run a Mezzio application on my server I do the following steps : - Create a Mezzio project我尝试在我的服务器上运行 Mezzio 应用程序我执行以下步骤: - 创建一个 Mezzio 项目

composer create-project mezzio/mezzio-skeleton symphonie

I choose modular application, fast router, service manager, plates renderer and Whoops I create my virtual host like this :我选择模块化应用程序、快速路由器、服务管理器、板渲染器和哎呀我像这样创建我的虚拟主机:

<VirtualHost *:80>
        Alias /symphonie "/data/symphonie/public"
    <Directory "/data/symphonie">
        Options Indexes MultiViews FollowSymlinks
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

But when I enter this url in Google Chrome : https://app.inra.fr/symphonie/ I got a 404 error.但是当我在谷歌浏览器中输入这个网址时: https : //app.inra.fr/symphonie/我收到了 404 错误。 I have no messages in the apache logs.我在 apache 日志中没有消息。 By cons all the links on the page redirects me to https://app.inra.fr/ and not to https://app.inra.fr/symphonie/ Here is the configuration of my server:通过缺点页面上的所有链接将我重定向到https://app.inra.fr/而不是https://app.inra.fr/symphonie/这是我的服务器的配置:

  • Centos 8 Centos 8
  • Apache 2.4 with rewrite module enabled启用重写模块的 Apache 2.4
  • PHP 7.3 PHP 7.3

Do you have any leads to solve my problem?你有任何线索可以解决我的问题吗?

thanks in advance提前致谢

Shishi石狮

Mezzio application does not have built-in support for base path. Mezzio 应用程序没有对基本路径的内置支持。

You would need to handle following aspects:您需要处理以下几个方面:

  • web server rewrites for subfolder. Web 服务器重写子文件夹。 Looks like you did that part.看起来你做了那部分。
  • middleware will need to be piped early to remove base path from request object before passing it further中间件将需要尽早通过管道从请求对象中删除基本路径,然后再进一步传递它
  • base path url helper.基本路径 url 助手。
    Mezzio provides url helper in mezzio/mezzio-helpers package. Mezzio 在mezzio/mezzio-helpers包中提供了 url helper。 Middleware from the previous step could also be used to inject base path into url helper.上一步中的中间件也可用于将基本路径注入 url helper。 If some of your middlewares use different ways to handle urls, those will need to be setup as well.如果您的某些中间件使用不同的方式来处理 url,则也需要设置这些方式。

Mezzio documentation have the page covering this use case: https://docs.mezzio.dev/mezzio/v3/cookbook/using-a-base-path/ Mezzio 文档有涵盖此用例的页面: https ://docs.mezzio.dev/mezzio/v3/cookbook/using-a-base-path/
It is not too detailed and pull requests to improve it are welcome ;)它不是太详细,欢迎请求改进它;)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM