我为magento2设置了nginx设置,但我想知道如何使用lighttpd。
我希望你们建议每个人如何创建类似如下的语法:
Nginx Block语法:
# Pub lines
location /pub/static/ {
# Uncomment the following line in production mode
# expires max;
# Remove signature of the static files that is used to overcome the browser cache
location ~ ^/pub/static/version {
rewrite ^/pub/static/(version\d*/)?(.*)$ /pub/static/$2 last;
}
location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ {
add_header Cache-Control "public";
add_header X-Frame-Options "SAMEORIGIN";
expires +1y;
if (!-f $request_filename) {
rewrite ^/pub/static/(version\d*/)?(.*)$ /pub/static.php?resource=$2 last;
}
}
location ~* \.(zip|gz|gzip|bz2|csv|xml)$ {
add_header Cache-Control "no-store";
add_header X-Frame-Options "SAMEORIGIN";
expires off;
if (!-f $request_filename) {
rewrite ^/pub/static/(version\d*/)?(.*)$ /pub/static.php?resource=$2 last;
}
}
if (!-f $request_filename) {
rewrite ^/pub/static/(version\d*/)?(.*)$ /pub/static.php?resource=$2 last;
}
add_header X-Frame-Options "SAMEORIGIN";
}
# End Pub lines
Lighttp Block语法:
如何使用lighttpd语法执行相同操作?
问候。
Ricardo / Brqx。
答案 0 :(得分:1)
这是使用magento2设置lighttpd的第一个选项。我会更新一次。
-Brqx Magento 2 - Url重写如果没有文件
-url.rewrite-repeat允许连续应用多个(单独定义的)重写规则 如果表达式匹配,-url.rewrite-once将导致跳过进一步的重写规则
url.rewrite-once =(
“^ / pub / static /(version \ d * /)(。*)$”=> “/ pub / static / $ 2”)
url.rewrite-if-not-file =(
“^ / pub / static /(”+ var.asset_file_regex +“)$”=> “/pub/static.php?resource=$2”,
“^ / pub / media /(”+ var.asset_file_regex +“)$”=> “/pub/get.php?resource=$1”,
“^ / setup”=> “/setup/index.php$1”,
“^ / update”=> “/update/index.php$1”,
“(。*)”=> “/index.php$1”
)
在这里,我为Lighttpd为Magento2安装了一个格式良好的github仓库:
https://gist.github.com/freestream/5bc28cfc716d1f9132f2
此外,我已更新了我的KB并解决了这个问题并解释了解决方案(很快我将创建一个包含所有设置的github仓库):
问候。
Ricardo / Brqx。