


PHP program of zf2 framework, the test environment uses apache, and the quasi-production environment uses nginx, problems arise
使用zf2框架开发的PHP程序
开发在路由的结尾增加了/以解决404的问题
在测试环境(使用apache)是正常的
而在准生产环境(使用nginx)不正常
路由去掉/也可以访问,但增加/后在nginx环境下会自动跳转到路由的首页,而开发的代码部分连接已经带了/,只能想办法删除结尾的/
使用关键词 “nginx 结尾斜杠”在google搜索到的解决办法解决不了这个问题
改用关键词“nginx slash end”在google搜索看到类似How to remove trailing slash from URL using Nginx文章
解决办法:修改这个项目的nginx的vhost配置文件
增加一行
rewrite ^/(.*)/$ /$1 permanent;
类似这样:
<span>server { listen :80; server_name www.site.com; rewrite ^/(.*)/$ /$1 permanent; }</span>
service nginx reload
以上就介绍了zf2框架的PHP程序,测试环境使用apache,准生产环境使用nginx,出现的问题,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Google recently responded to the performance concerns about the Tensor G4 of the Pixel 9 line. The company said that the SoC wasn't designed to beat benchmarks. Instead, the team focused on making it perform well in the areas where Google wants the c

Google has introduced DisplayPort Alternate Mode with the Pixel 8 series, and it's present on the newly launched Pixel 9 lineup. While it's mainly there to let you mirror the smartphone display with a connected screen, you can also use it for desktop

Google's AI Test Kitchen, which includes a suite of AI design tools for users to play with, has now opened up to users in well over 100 countries worldwide. This move marks the first time that many around the world will be able to use Imagen 3, Googl

Google's new Pixel 9 series has introduced a new variant that wasn't present in previous lineups, the Pixel 9 Pro XL. It is essentially identical to the non-XL variant (pre-order at Amazon), but as the name suggests, it has a larger screen. The two e

The Pixel 9 Pro Fold is akin to a volte-face for Google's nascent foldable division. In fact, such are the differences between thePixel 9 Pro Foldand the Pixel Fold that the former has been compared more against the OnePlus Open (curr. $1,399.99 on A

The Google Pixel 9 Pro and Pro XL are Google's answers to the likes of the Samsung Galaxy S24 Ultra and the Apple iPhone 15 Pro and Pro Max. Daniel Sin on YouTube(watch below) has compared the Google Pixel 9 Pro XL to the iPhone 15 Pro Max with some

Hardly any time has passed since Google announced its first Pixel 9 series smartphones. In fact, it has only just started shipping the Pixel 9, Pixel 9 Pro and Pixel 9 Pro XL (curr. $1,099 on Amazon). By contrast, Pixel 9 Pro Fold pre-orders will not

Google's Tensor SoCs have long been the subject of criticism for their mediocre performance and thermal throttling. The Google Tensor G4 in the newly announced Google Pixel 9 Pro XL seems to suffer even more than its predecessor in this regard. Accor
