Nginx Extension realurl-在URL中显示SQL查询部分

Nginx Extension realurl-在URL中显示SQL查询部分,nginx,typo3,typo3-8.x,realurl,Nginx,Typo3,Typo3 8.x,Realurl,首先,我必须处理与项目相关的TYPO3版本升级,而且我对Nginx web服务器也相对较新 我已经将TYPO3安装版本从7.6-LTS升级到8.7-LTS,并将该站点从IIS(Windows)服务器转移到带有Nginx的Ubuntu 18.04系统 我现在发现:第一次点击菜单中网站的内部链接,例如domain.com/prices可以正常工作。调用URLdomain.com/prices,并在URL中显示。现在当页面被重新加载时,相同的菜单项链接现在看起来像这样 domain.com/index

首先,我必须处理与项目相关的TYPO3版本升级,而且我对Nginx web服务器也相对较新

我已经将TYPO3安装版本从7.6-LTS升级到8.7-LTS,并将该站点从IIS(Windows)服务器转移到带有Nginx的Ubuntu 18.04系统

我现在发现:第一次点击菜单中网站的内部链接,例如
domain.com/prices
可以正常工作。调用URL
domain.com/prices
,并在URL中显示。现在当页面被重新加载时,相同的菜单项链接现在看起来像这样

domain.com/index.php?id=8&L=1%20or%20%281%2C2%29%3D%28select%2Afrom%28select%20name_const%28CHAR%28111%2C108%2C111%2C108%2C111%2C115%2C104%2C101%2C114%29%2C1%29%2Cname_const%28CHAR%28111%2C108%2C111%2C108%2C111%2C108%2C111%2C115%2C104%2C101%2C114%29%2C1%29%29a%29%20- -%20and%201%3D1 
…而不是通常的
domain.com/prices
。页面的oontent仍然正确,因此正在加载正确的页面

Typo3安装使用扩展名
real url
,这正是该功能的特点。它将
domain.com/index.php?id=8&L=1…
转换为像
domain.com/prices
这样的口语url。那么,为什么它在第一次加载时工作,但之后不再工作

我还认为,这可能是Nginx配置的问题,但现在我认为这是一个不同的主题,因为如果这是一个web服务器问题,第一次就不会工作了,是吗

什么会导致这种行为

更新 事实上,我看到,网站的英文版运行良好。因此,这里正确显示了链接:
domain.com/prices
domain.com/modules
,甚至没有首页加载

也许会有帮助。这是Nginx配置,我目前使用:

server {
    listen 80;
    server_name domain.com;
    root /var/www/domain.com/public;
    index index.php index.html index.htm index.nginx-debian.html;

    listen 443 ssl;
    ssl_certificate /var/www/domain.com/ssl/domain.com-2020.crt;
    ssl_certificate_key /var/www/domain.com/ssl/domain.com-2020.rsa;

    location / {
        try_files $uri $uri/ /index.php$is_args$args;
    }

    # Special root site case. prevent "try_files $uri/" + "index" from skipping the cache
    # by accessing /index.php directly
    location =/ {
        recursive_error_pages on;
        error_page 405 = @sfc;
        return 405;
    }

    location @t3frontend {
        # Using try_files for ease of configuration demonstration here,
        # you can also fastcgi_pass directly to php here
        try_files $uri /index.php$is_args$args;
    }

    location @sfc {
        # Perform an internal redirect to TYPO3 if any of the required
        # conditions for StaticFileCache don't match
        error_page 405 = @t3frontend;

        # Query String needs to be empty
        if ($args != '') {
            return 405;
        }

        # We can't serve static files for logged-in BE/FE users
        if ($cookie_staticfilecache = 'fe_typo_user_logged_in') {
            return 405;
        }
        if ($cookie_be_typo_user != '') {
            return 405;
        }

        # Ensure we redirect to TYPO3 for non GET/HEAD requests
        if ($request_method !~ ^(GET|HEAD)$ ) {
            return 405;
        }

        charset utf-8;
        try_files /typo3temp/tx_staticfilecache/${scheme}/${host}/${server_port}${uri}/index.html
        /typo3temp/tx_staticfilecache/${scheme}/${host}/${server_port}${uri}
        =405;
    }

    location /typo3temp/tx_staticfilecache {
            deny all;
    }

    location ~ \.php$ {
            include snippets/fastcgi-php.conf;
            fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
    }

    location ~ /\.ht {
            deny all;
    }

    # Prevent clients from accessing hidden files (starting with a dot)
    # This is particularly important if you store .htpasswd files in the site hierarchy
    # Access to `/.well-known/` is allowed.
    # https://www.mnot.net/blog/2010/04/07/well-known
    # https://tools.ietf.org/html/rfc5785
    location ~* /\.(?!well-known\/) {
        deny all;
    }

    # Prevent clients from accessing to backup/config/source files
        location ~* (?:\.(?:bak|conf|dist|fla|in[ci]|log|psd|sh|sql|sw[op])|~)$ {
        deny all;
    }

    # TYPO3 - Block access to composer files
    location ~* composer\.(?:json|lock) {
        deny all;
    }

    # TYPO3 - Block access to flexform files
    location ~* flexform[^.]*\.xml {
        deny all;
    }

    # TYPO3 - Block access to language files
    location ~* locallang[^.]*\.(?:xml|xlf)$ {
        deny all;
    }

    # TYPO3 - Block access to static typoscript files
    location ~* ext_conf_template\.txt|ext_typoscript_constants\.(?:txt|typoscript)|ext_typoscript_setup\.(?:txt|typoscript) {
        deny all;
    }

    # TYPO3 - Block access to miscellaneous protected files
    location ~* /.*\.(?:bak|co?nf|cfg|ya?ml|ts|typoscript|dist|fla|in[ci]|log|sh|sql)$ {
        deny all;
    }

    # TYPO3 - Block access to recycler and temporary directories
    location ~ _(?:recycler|temp)_/ {
        deny all;
    }

    # TYPO3 - Block access to configuration files stored in fileadmin
    location ~ fileadmin/(?:templates)/.*\.(?:txt|ts|typoscript)$ {
        deny all;
    }

    # TYPO3 - Block access to libaries, source and temporary compiled data
    location ~ ^(?:vendor|typo3_src|typo3temp/var) {
        deny all;
    }

    # TYPO3 - Block access to protected extension directories
    location ~ (?:typo3conf/ext|typo3/sysext|typo3/ext)/[^/]+/(?:Configuration|Resources/Private|Tests?|Documentation|docs?)/ {
        deny all;
    }
}
server {
    if ($host = domain.com) {
        return 301 https://$host$request_uri;
    }


        listen 80;
        server_name domain.com;
    return 404; 
}
这是
realurl
的配置:

模板分析没有显示任何错误。这是对
realurl
的模板分析:

更新2 我在这个问题上更进一步了。我已经阅读了与我的问题类似的错误报告。我试图将
config.linkVars
值从
L
切换到
L(0,1)
。这有助于解决URL问题。但现在它总是回到德语

通过
config.linkVars
中的设置
L
,它在url中添加了语言(如果不是德语):

domain.com/en/prices

使用新值
L(0,1)
将删除URL中的语言

domain.com/prices


所以它总是显示页面的德语版本。我甚至尝试将值设置为
L(0,2)
,因为德语、英语和法语是集成的(1=英语,2=法语),但在这种情况下没有帮助。由于URL中缺少语言代码,它总是切换回德语。

好。现在我找到了解决办法。 正如我在评论中所写,这是配置设置:

config.linkVars
最初设定为

config.linkVars = L
在我找到这个bug报告之后

我看到出于安全原因,我需要限制
L
-值。 在我们的案例中,0代表德语,1代表英语,2代表法语:

config.linkVars = L(0-2)

然后一切正常。

首先,我要检查为什么在语言参数(&L=1)之后添加了sql查询的一部分。也许你的打字稿有问题。也许链接是正确的。@RenéPflamm,谢谢你的回答。你能告诉我在哪里可以检查这个吗?查看模板下的打字脚本对象浏览器,如果显示常量,则切换到打字脚本,搜索
name\u const
或查询中的其他内容。可能模板分析(也在模板下)显示了一些故障。在键入脚本中定义L参数的位置显示备选选项,并查看是否缺少大括号。我已从
realurl
添加了配置。在Typscript对象浏览器的常量中,没有来自
realurl
@RenéPflamm的条目,我向前迈出了一步。我找到了这个bug报告,这解释了我的问题。我已将
config.linkVars
值从
L
更改为
L(0,1)
,这对URL问题没有帮助,但现在它总是切换回德语。你知道如何避免这种情况吗?