Articles of apache 2.4

eXist后面的Apache代理 – 身份validation

我运行一个在Apache后面代理的eXist db XML数据库。 httpd.conf的设置如下: <VirtualHost *:80> ServerName foo ServerAlias foo ProxyRequests Off <Proxy *> Order deny,allow Allow from all </Proxy> ProxyPass / http://localhost:8080/exist/apps/foo/ ProxyPassReverse / http://localhost:8080/exist/apps/foo/ ProxyTimeout 20 ProxyPassReverseCookiePath /exist / ProxyPassReverseCookieDomain localhost foo RewriteEngine on RewriteRule ^/(.*)$ /$1 [PT] </VirtualHost> 这工作得很好。 通过浏览器访问http://localhost ,我不会提示input任何密码。 但是,我现在想要保护Apache可能发送或代理(包括ErrorDocuments)与基本用户身份validation的一切。 所以,我补充说 <Location /> AuthUserFile /etc/users AuthName "Beta testers only" AuthType […]

在Apache中禁用单个文件的https

很长一段时间,我没有在我的linux服务器上使用https,因为我没有find适合我需求的体面的CA. 现在,让我们encryption(一个提供免费证书的新的CA)已经推出了他们的公开testing版,所以我马上得到了他们的证书。 我现在将所有的请求redirect到https,一切工作正常,但由于我已经使用HTTP的年龄,我将需要一些时间来重写一些客户端软件取决于wbesite是http。 不幸的是,我现在无法部署更新,因为更新机制现在也被破坏:/ 所以我的问题是:有没有办法在apache2中禁用单个文件的https? 我更喜欢使用一个简单的.htaccess文件的解决scheme,但也有人赞赏。 这是通过letsencrypt添加到VirtualHost *:80 : RewriteEngine on RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [L,QSA,R=permanent]

为什么我的Apache LocationMatch指令不工作?

我需要帮助让Apache的LocationMatch工作。 我试图build立一个补鞋匠服务器,并且默认情况下需要SSL。 我想重写,以便人们可以使用http:// server / cobbler_web,而不是https:// server / cobbler_web ,并将它们带到同一页面。 我正在尝试使用LocationMatch来匹配URL中的cobbler_web ,如下所示: ### Force SSL only on the WebUI <VirtualHost *:80> <LocationMatch "^/cobbler_web/"> RewriteEngine on RewriteRule ^(.*) https://%{SERVER_NAME}/%{REQUEST_URI} [R,L] </LocationMatch> </VirtualHost> 但无论我在LocationMatch行尝试什么,都没有任何效果。 我试过了你上面看到的那一行,还有.*cobbler_web.*和^/cobbler_web/.*等等。 没有快乐。 如果我完全删除LocationMatch ,它的工作。 谢谢。

只有当查询参数不等于某个值时,HTTPS才会在htaccess中redirect

背景 我设法通过在我的.htaccess文件中包含这个代码片段来让httpredirect工作在我的Wordpress安装中: <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTP:X-Forwarded-Proto} !https RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] </IfModule> 我在Google Cloud环境中运行,问题是运行状况检查要求“健康检查资源”返回200 OK 。 运行状况检查会发出一个不包含X-Forwarded-Proto头部信息的HTTP请求,所以Apache将以301做出响应,因此运行状况检查失败(不遵循redirect)。 不幸的是,在Google Health Checker中定义头文件是不可能的,所以我不能将X-Forwarded-Proto头文件伪装成“https”。 所以我希望有一个解决方法是在运行状况检查path中提供查询参数,并将.htaccess文件configuration为只有在指定的查询参数未定义(或等于false或类似)时才redirect。 题 如果X-Forwarded-Proto头部不等于https (如上例所示)并且查询string不包含参数healthCheck=true那么如何修改RewriteCond (我假设)只执行redirect?

在<location>括号中的SSL mod_proxy问题

我有麻烦得到proxypass在Apache中工作。 我的configuration文件如下: <VirtualHost 1.2.3.4:443> ServerName example.com ServerAlias www.example.org ServerAdmin [email protected] DocumentRoot /home/admin/web/knyz.org/public_html ScriptAlias /cgi-bin/ /home/admin/web/knyz.org/cgi-bin/ Alias /vstats/ /home/admin/web/knyz.org/stats/ Alias /error/ /home/admin/web/knyz.org/document_errors/ #SuexecUserGroup admin admin CustomLog /var/log/apache2/domains/knyz.org.bytes bytes CustomLog /var/log/apache2/domains/knyz.org.log combined ErrorLog /var/log/apache2/domains/knyz.org.error.log <Directory /home/admin/web/knyz.org/public_html> AllowOverride All SSLRequireSSL Options +Includes -Indexes +ExecCGI </Directory> <Directory /home/admin/web/knyz.org/stats> AllowOverride All </Directory> SSLEngine on SSLVerifyClient none SSLCertificateFile /home/admin/conf/web/ssl.knyz.org.crt SSLCertificateKeyFile /home/admin/conf/web/ssl.knyz.org.key […]

使用Apache2从同一个URL向web根外的多个目录提供服务

是否可以设置Apache来从同一个URL提供多个目录? 例如,假设我有两个位置的映像:/ mnt / imagestore1,/ mnt / imagestore2。 我想mysite.com/images/file.jpg显示从任一目录的图像。 它似乎不像以下这样的别名: Alias /images /mnt/imagestore1 Alias /images /mnt/imagestore2 而在文档根目录下使用mod_rewrite和.htaccess也没有起作用,尽pipe我对mod_rewrite的理解可能不在这里: RewriteCond /mnt/imagestore1/%{REQUEST_URI} -f RewriteRule ^(.+) /mnt/imagestore1/$1 [L] RewriteCond /mnt/imagestore2/%{REQUEST_URI} -f RewriteRule ^(.+) /mnt/imagestore2/$1 [L]

Apachepipe道日志logging失败

我想写一个简单的Apachepipe道日志logging指令,我正在失败。 我只想grep出200个响应代码集中我的日志文件到ELK。 这是我创build的自定义日志格式。 LogFormat "%s %h %l %u %t \"%r\" %b" remove 这是pipe道日志 CustomLog "|/bin/grep -v '^200' /var/log/apache2/pi-mirror.com/access.log" remove 我在apache2错误日志中得到以下错误。 AH00106: piped log program '/bin/grep -v '^200' /var/log/apache2/pi-mirror.com/access.log' failed unexpectedly 我似乎无法弄清楚这里发生了什么。 我通过apaches文档阅读pipe道日志logging,我找不到任何可能做错的事情。 这在Apache2 2.4.7上运行 预先感谢您的帮助。 注意 进一步研究,我发现apache 2.2和apache 2.4改变了这种做法。 以前,shell是自动生成的,但在新的2.4版本中,您必须手动指定一个shell。 结果我改变了我的语法 CustomLog "|$/bin/grep -v '^200' /var/log/apache2/pi-mirror.com/access.log" remove 这个改变做了以下。 由于某种原因,当我重新启动apache2它吐出所有的输出到stdout,我从terminal看到这一切。 但是,然后失败,相同的错误信息。 这几乎就像apache没有真正开始这个重复的,这让我想知道如果我需要做别的事情来解决这个问题。

Apache 14.04上的图表和数据不在Munin中更新

所以我正在从Ubuntu 12.04重build一个服务器到Ubuntu 14.04; 没有做升级path,因为我宁愿在这种情况下从头开始构build。 我已经安装了Munin,就像我之前在Ubuntu 12.04中所做的那样: sudo aptitude install munin munin-node 然后,我启用了如下的Munin的Apache模块: sudo ln -s /usr/share/munin/plugins/apache_accesses /etc/munin/plugins/apache_accesses sudo ln -s /usr/share/munin/plugins/apache_processes /etc/munin/plugins/apache_processes sudo ln -s /usr/share/munin/plugins/apache_volume /etc/munin/plugins/apache_volume 然后我重新启动了这个Munin节点: sudo service munin-node restart 等待所需的5-10分钟,以获得数据和相关的graphics生成。 快乐的图表出现了! 但不幸的是,所有的价值都是 – -nan ,这意味着数据不是由穆宁处理; 看下面的截图: 通常这意味着Munin在到达本地主机的Apache service-status页面时遇到了问题,但是使用Lynx检查系统上的URL显示一切正常: lynx http://localhost/server-status 所以我被困在可能发生的事情上。 一个完整的系统重新启动,100%没有改善。 会发生什么?

将所有http和https域名stream量重写为基于https的url的问题

我正试图获得所有的变化 http://www.example.com http://example.com https://www.example.com https://example.com www.example.com example.com 全部redirect到 https://www.example.com 我有以下mod_rewrite块: RewriteEngine on ReWriteCond %{SERVER_PORT} !^443$ RewriteCond %{HTTP_HOST} ^([az.]+)?example.com$ [NC] RewriteCond %{HTTP_HOST} example.com$ [NC] RewriteRule .? https://www.example.com%{REQUEST_URI} [R=301,L] 似乎除了一个: https://example.com不会被redirect到 按预期https://www.example.com 如果我删除了条件: ReWriteCond %{SERVER_PORT} !^443$ 所以它影响http和https,它仍然不像预期的那样。 我哪里错了? 谢谢

我可以在Linux Enterprise Server 11 SP4上安装最新版本的OpenSSL和Apache吗?

我找不到OpenSSL和Apache的最低操作系统要求。 我想知道是否可以在Linux SUSE Enterprise Server SP4上安装OpenSSL 1.0.2和Apache 2.4.x。