首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Magento2 - Lighttpd格式-如何为magento2创建lighttpd配置

Magento2 - Lighttpd格式-如何为magento2创建lighttpd配置
EN

Stack Overflow用户
提问于 2016-10-29 16:14:50
回答 1查看 159关注 0票数 0

我有一个用于magento2的nginx设置,但我想知道如何使用too lighttpd。

我想向大家推荐如何创建类似的语法,如下所示:

Nginx块语法:

代码语言:javascript
复制
# 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块语法:

如何使用lighttpd语法来做同样的事情呢?

致以问候。

里卡多/布尔克斯。

EN

回答 1

Stack Overflow用户

发布于 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

致以问候。

里卡多/布尔克斯。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/40317285

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档