我有一个用于magento2的nginx设置,但我想知道如何使用too lighttpd。
我想向大家推荐如何创建类似的语法,如下所示:
Nginx块语法:
# 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 linesLighttp块语法:
如何使用lighttpd语法来做同样的事情呢?
致以问候。
里卡多/布尔克斯。
发布于 2016-10-29 20:23:15
这里是使用magento2设置lighttpd的第一个选项。一旦改进,我会更新的。
-Brqx Magento 2-如果没有文件,则重写
-url.rewrite-repeat允许在一行中应用多个(单独定义的)重写规则-url.rewrite-once将导致在匹配表达式的情况下跳过进一步的重写规则
url.rewrite-once =(
“^/pub/static/(版本\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”
)
这里我为Magento2的Lighttpd放了一个格式良好的github代码库:
https://gist.github.com/freestream/5bc28cfc716d1f9132f2
另外,我已经用这个问题更新了我的知识库,并解释了解决方案(很快我会创建一个包含所有设置的github存储库):
http://brqxportals.com/kb/systems/magento/versions/magento_20/pages/n01/m01_004-lighttpd_settings.html
致以问候。
里卡多/布尔克斯。
https://stackoverflow.com/questions/40317285
复制相似问题