htaccess 具有授权标头重写的 nginx 配置

问题描述 投票:0回答:1

我正在将 apache 托管的 laravel 应用程序转换为在 docker 容器中使用 nginx 和 PHP-FPM。

这是htaccess

<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
    Options -MultiViews -Indexes
</IfModule>

RewriteEngine On

#ErrorDocument 200 "Hello. This is your .htaccess file talking."
#RewriteRule ^ - [L,R=200]

# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]

# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>

自动转换无法转换

RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

谢谢您的提前。

.htaccess nginx
1个回答
0
投票

很好,但如果你正确遵守规则的话会更好

© www.soinside.com 2019 - 2024. All rights reserved.