Articles of apache 2.2

在Apache2中使用Header添加获取客户端IP

我正在尝试在HTTP标头中获取客户端IP。 我已经看到很多引用在日志中得到这个,但我不知道这是如何转换为传递它作为标题。 我打算使用像下面的头添加,但不知道如何引用客户端IP。 任何帮助,将不胜感激。 Header add X-Forwarded-For "Client IP"

在Apache中使用SSL将一个虚拟主机redirect到另一个虚拟主机

这里是我的情况:我有两个CNAME域( domain.one.com和domain.two.com )指向相同的IP /机器,我想redirect到另一个,如domain.one.com/anything到domain.two.com/anything 。 domain.two.com有一个有效的SSL证书。 我有以下设置: 在httpd.conf : RewriteCond %{HTTP_HOST} ^domain\.two\.com [NC] RewriteCond %{HTTP_HOST} !^$ RewriteRule ^/(.*) https://domain.two.com/$1 [L,R] NameVirtualHost *:80 NameVirtualHost domain.two.com:443 <VirtualHost *:80> ServerName domain.two.com DocumentRoot "/var/www/html/" ErrorLog logs/error_log CustomLog logs/access_log common RewriteEngine On RewriteOptions Inherit </VirtualHost> 在ssl.conf : <VirtualHost domain.two.com:443> DocumentRoot "/var/www/html" ServerName domain.two.com:443 </VirtualHost> – 我到目前为止所尝试的: 添加到httpd.conf中: NameVirtualHost domain.one.com:443 <VirtualHost […]

使用htaccess将所有来自多个域的stream量redirect到单个域

我在我的服务器上托pipe了多个网站,所有这些网站都共享一个htaccess的相同代码库。 我需要这样的东西。 如果(域名!= example.com)redirect到example.com 如果有任何处理这个从htaccess的方式 使用以下但仍然不工作 RewriteCond !^(.*)$ https://example1.com/$1 [NC] RewriteRule ^(.*)$ https://example2.com/$1 [R=301,NC,L]

AH00027:从Apache 2.2升级到2.4后没有validation完成错误

我最近更新在OS OS 7上的Apache从2.2到2.4,更新后,我无法访问根文件夹, 我得到以下错误: [Fri Apr 29 16:30:19.977037 2016] [core:error] [pid 32095] [client 10.211.55.1:44429] AH00027: No authentication done but request not allowed without authentication for /. Authentication not configured? 正如在授权部分中提到的,您仍然可以使用旧指令Order,Allow,Deny和Satisfy通过加载模块(我明显加载): LoadModule access_compat_module modules/mod_access_compat.so 我的目录指令如下: <Directory /> Options FollowSymLinks AllowOverride All </Directory> 我不确定这个问题会是什么,我真的很感谢这里的一些帮助。

使用Apache Web服务器下载文件

在Centos-6机器上,我设置了Apache Web服务器,默认文件夹是/var/www/html 。 在存在一个空的index.html ,通过在浏览器中input机器的IP地址,我看到空白的白色屏幕。 这意味着,Web服务器正在工作。 当我把一个文件下载,问题是当我input机器的IP地址,我仍然看到页面上的空白。 我希望看到像这样的结构树。 我该如何解决?

Modsecurity检查不带查询参数的REQUEST_URI

目前,我正在使用Modsecurity XSS预防,但是我很难理解我可以如何限制在REQUEST_URIvariables中检查的内容。 我的例子: # # -=[ XSS Filters – Category 3 ]=- # XSS vectors making use of Javascripts URIs, eg, <p style="background:url(javascript:alert(1))"> # SecRule REQUEST_URI|ARGS "(?i)((?:=|U\s*R\s*L\s*\()\s*[^>]*\s*S\s*C\s*R\s*I\s*P\s*T\s*:|&colon;|[\s\S]allowscriptaccess[\s\S]|[\s\S]src[\s\S]|[\s\S]data:text\/html[\s\S]|[\s\S]xlink:href[\s\S]|[\s\S]base64[\s\S]|[\s\S]xmlns[\s\S]|[\s\S]xhtml[\s\S]|[\s\S]style[\s\S]|<style[^>]*>[\s\S]*?|[\s\S]@import[\s\S]|<applet[^>]*>[\s\S]*?|<meta[^>]*>[\s\S]*?|<object[^>]*>[\s\S]*?)" "id:'973338',phase:2,t:none,rev:'1',ver:'OWASP_CRS/2.2.9',maturity:'1',accuracy:'8',t:urlDecodeUni,t:htmlEntityDecode,t:jsDecode,t:cssDecode,log,capture,tag:'OWASP_CRS/WEB_ATTACK/XSS',tag:'WASCTC/WASC-8',tag:'WASCTC/WASC-22',tag:'OWASP_TOP_10/A2',tag:'OWASP_AppSensor/IE1',tag:'PCI/6.5.1',msg:'XSS Filter – Category 3: Javascript URI Vector',logdata:'Matched Data: %{TX.0} found within %{MATCHED_VAR_NAME}: %{MATCHED_VAR}',severity:'2',setvar:'tx.msg=%{rule.msg}',setvar:tx.xss_score=+%{tx.critical_anomaly_score},setvar:tx.anomaly_score=+%{tx.critical_anomaly_score},setvar:tx.%{rule.id}-OWASP_CRS/WEB_ATTACK/XSS-%{matched_var_name}=%{tx.0}" 在上面的例子中,正则expression式检查某些标签,如果find,停止请求,logging尝试,然后抛出一个403禁止。 这很好,但我有一个特定的URL,看起来像这样: /chart.php?this=haha&style=testStyle Where &style=使ModSecurity引发错误并停止请求。 同样,他们有一个规则,只是检查style= , 所以我的问题是,我怎么能改变REQUEST_URI的方式(在ModSecurity规则内),以便规则只检查之前的一切? (请求参数)。

启用S​​SL后禁止虚拟主机

我为我的wamp64服务器启用了SSL,并且对于http:// localhost /和https:// localhost /都可以正常工作。 但我没有启用它来看本地主机 – 我需要激活我的虚拟主机之一: <VirtualHost *:443> DocumentRoot "D:/DEV/www/app/public/" ServerName dev.app.com:443 ServerAdmin admin@localhost ErrorLog "D:/wamp64/www/ssllogs/ssl_error.log" TransferLog "D:/wamp64/www/ssllogs/ssl_access.log" SSLEngine on SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL SSLCertificateFile "D:/wamp64/ssl.crt/server.crt" SSLCertificateKeyFile "D:/wamp64/ssl.key/server.key" <FilesMatch "\.(cgi|shtml|phtml|php)$"> SSLOptions +StdEnvVars </FilesMatch> <Directory "D:/DEV/www/app/public"> SSLOptions +StdEnvVars Options Indexes FollowSymLinks Includes ExecCGI AllowOverride All Order deny,allow Allow from all </Directory> BrowserMatch ".*MSIE.*" \ nokeepalive ssl-unclean-shutdown […]

获取用户的服务器统计信息

我用centos运行一个服务器,ispconfig,大概有100个网站。 它偶尔会得到高负荷,但我没有真正的方法来查明是什么造成这种情况。 我真的想看到每个用户/网站点击量/ CPU使用情况(每个网站都有自己的用户)。 这似乎应该很简单,我已经尝试了许多报告包,包括Munin,Goaccess等,但没有一个给我所需要的。 任何可以做到这一点的软件build议? 谢谢。

从web表单以root身份调用CGI python脚本

我很难得到一个Web窗体来运行一个CGI脚本,需要执行一个具有root权限的命令。 表格是: <form class="mainform" action="./py/print_msg.py" method="POST"> <textarea name="post" cols=70 rows=20></textarea><br> <input type="submit" value="Print" class="button"> <input type="reset" value="Clear" class="button"> </form> python脚本print_msg.py是可执行文件( -rwxr-xr-x 1 root root ),并且只是打印string到浏览器的版本就可以正常工作,所以apache的CGI设置就好了。 #!/usr/bin/env python from Adafruit_Thermal import * print "Content-type: text/html\n\n" printer = Adafruit_Thermal("/dev/ttyAMA0", 19200, timeout=5) printer.wake() time.sleep(1) print "test" printer.sleep() 这在root运行时有效。 我编辑了/etc/sudoers如下: www-data ALL=(ALL) NOPASSWD: /usr/bin/sudo -u root /home/pi/www/html/py/print_msg.py 不知道这是否意味着万维网数据可以运行该脚本作为根或如果它会这样做,而不需要调用sudo ? […]

如何在Apache的mod_status只过滤端口80和443?

有没有办法只显示端口80和443的请求时查看mod_status /服务器状态? 我的/etc/apache2/mods-available/status.conf文件: <IfModule mod_status.c> # Allow server status reports generated by mod_status, # with the URL of http://servername/server-status # Uncomment and change the "192.0.2.0/24" to allow access from other hosts. <Location /server-status> SetHandler server-status #Require local #Require ip 192.0.2.0/24 Order allow,deny Allow from all </Location> # Keep track of extended status information for each […]