Centos 7.5 适用于 .net core 的 apache 代理

Centos 7.5 适用于 .net core 的 apache 代理

我按照说明将 .netcore 设置为 apache 代理服务器。这是我的虚拟主机。

<VirtualHost *:*>
    RequestHeader set "X-Forwarded-Proto" expr=%{REQUEST_SCHEME}
</VirtualHost>
<VirtualHost *:80>
    ProxyPreserveHost On
    ProxyPass / http://127.0.0.1:5000/
    ProxyPassReverse / http://127.0.0.1:5000/
    ServerName localhost.
    ServerAlias *.pointtechsol.com
    ErrorLog ${APACHE_LOG_DIR}pts-error.log
    CustomLog ${APACHE_LOG_DIR}pts-access.log common
</VirtualHost>

这是我收到的错误:

service httpd configtest
[Mon Jan 07 17:46:41.520033 2019] [core:warn] [pid 5971] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Mon Jan 07 17:46:41.520137 2019] [core:warn] [pid 5971] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
AH00526: Syntax error on line 2 of /etc/httpd/conf.d/pts.conf:
Unrecognized header format %

我查看了但找不到解决方案。请告诉我我可以发布哪些其他详细信息以寻求帮助。

尝试了这个但得到同样的错误:

<VirtualHost *:*>
    RequestHeader set "X-Forwarded-Proto" "expr=%{REQUEST_SCHEME}"
</VirtualHost>

答案1

问题似乎出在这里:

    RequestHeader set "X-Forwarded-Proto" expr=%{REQUEST_SCHEME}

文档表明包含任何特殊字符的表达式都应该用引号引起来,即:

    RequestHeader set "X-Forwarded-Proto" "expr=%{REQUEST_SCHEME}"

答案2

expr="%{REQUEST_SCHEME}e"

相关内容