如何将Apache配置为JFrog Xray的反向代理
主题:
Apache配置模板作为JFrog Xray 2.x的反向代理
适用的版本: 2.倍
注:来自Xray 3。x, having reverse proxy is not relevant. Because JFrog has come up with a platform from Artifactory version 7.x which is compatible with Xray3.x. All the JFrog products will be accessible from JFrog URL. For more details please refer to系统Arichture篇文章。
Xray2.x的Apache配置模板
为了将Apache配置为Xray的反向代理,您可以使用下面的模板并将其放置在各自的Apache目录中。
################################################
# Xray反向代理https+http与Apache
################################################
< VirtualHost *: 80 >
ProxyPreserveHost上
ServerName < your_server_name >
ServerAlias *。< your_server_name >
服务器server@admin
特定于应用程序的日志
${APACHE_LOG_DIR}/
${APACHE_LOG_DIR}/
AllowEncodedSlashes上
RewriteEngine上
rewritecsecond %{SERVER_PORT} (.*)
rewriterrule (.*) - [E=my_server_port:%1]
注意:' REQUEST_SCHEME '头只支持apache 2.4及以上版本
rewritecsecond %{REQUEST_SCHEME} (.*)
rewriterrule (.*) - [E=my_scheme:%1]
rewritecsecond %{HTTP_HOST} (.*)
rewriterrule (.*) - [E=my_custom_host:%1]
rewriterrule ^/$ /web/ [R,L]
RewriteRule ^ / (/) ?$ /web/ [R,L]
rewriterrule ^//web$ /web/ [R,L]
请求头设置主机%{my_custom_host}e
请求头设置X-Forwarded-Port %{my_server_port}
注意:{my_scheme}需要一个仅在apache 2.4及以上版本支持的模块
请求头设置x - forward - proto %{my_scheme}e
ProxyPassReverseCookiePath / /
ProxyRequests掉
ProxyPreserveHost上
ProxyPass / http://
ProxyPassReverse / http://
< /虚拟主机>
< VirtualHost *: 443 >
ProxyPreserveHost上
ServerName < your_server_name >
ServerAlias *。< your_server_name >
服务器server@admin
SSLEngine上
SSLCertificateFile /etc/apache2/mycert.cert
SSLCertificateKeyFile /etc/apache2/mykey.key
SSLProxyEngine上
特定于应用程序的日志
## ErrorLog ${APACHE_LOG_DIR}/xray1.shaibz-error.log
${APACHE_LOG_DIR}/xray1.shaibz-access.log组合
AllowEncodedSlashes上
RewriteEngine上
rewritecsecond %{SERVER_PORT} (.*)
rewriterrule (.*) - [E=my_server_port:%1]
注意:' REQUEST_SCHEME '头只支持apache 2.4及以上版本
rewritecsecond %{REQUEST_SCHEME} (.*)
rewriterrule (.*) - [E=my_scheme:%1]
rewritecsecond %{HTTP_HOST} (.*)
rewriterrule (.*) - [E=my_custom_host:%1]
rewriterrule ^/$ /web/ [R,L]
RewriteRule ^ / (/) ?$ /web/ [R,L]
rewriterrule ^//web$ /web/ [R,L]
请求头设置主机%{my_custom_host}e
请求头设置X-Forwarded-Port %{my_server_port}
注意:{my_scheme}需要一个仅在apache 2.4及以上版本支持的模块
请求头设置x - forward - proto %{my_scheme}e
ProxyPassReverseCookiePath / /
ProxyRequests掉
ProxyPreserveHost上
ProxyPass / http://
ProxyPassReverse / http://
< /虚拟主机>
将此配置放入Apache配置文件夹后,我们需要重新启动Apache服务。我们现在可以通过反向代理访问x射线。
