Articles of apache 2.4

如何使用mod_proxy – apache将FORWARD代理用户redirect到网页

我已经search了很多的解决scheme,大多数答案都属于proxypass(反向代理)或不相关。 最终用户的Web浏览器被configuration为使用Apache代理服务器。 我想将所有用户redirect到单个网页(如果可能,请在同一台服务器上)。 Mod_rewrite不起作用,因为只有当用户试图访问代理服务器时才会触发。 我想redirect尝试访问外部网站的用户。 目前的configuration很简单: /var/httpd/conf.d/proxy.conf: <VirtualHost *:*> ProxyRequests On ProxyVia On <Proxy *> Order deny,allow Deny from all Allow from 172.0.0.0/21 </Proxy> </VirtualHost> 我想阻止所有请求,然后设置一个自定义的错误页面,但找不到任何这个工作的例子。

Apache 2.4中的许多gettimeofday + fcgid + centos 6.6 – 静态文件的等待时间长

当我在apache进程上执行strace时,即使在Apache返回静态文件(如图像文件)时,我也会在GET请求之前和之后看到许多gettimeofday。 在Apache 2.4(使用php 5.6,fcgid)应答GET请求之前,会导致很长的停机时间。 1616 0.000048读取(156,“GET / HTTP / 1.1 \ r \ n”,8000)= 16 1616 0.000099 gettimeofday({1430592206,931114},NULL)= 0 1616 0.000044 gettimeofday({1430592206,931156},NULL)= 0 1616 0.000035读取(156,0x7f01d4007018,8000)= -1 EAGAIN(资源暂时不可用) 1616 0.000042 poll([{fd = 156,events = POLLIN}],1,7915439 1670 0.020724 <… epoll_wait恢复> {},100,100)= 0 1670 0.000039 gettimeofday({1430592206,951998},NULL)= 0 1670 0.000037 gettimeofday({1430592206,952034},NULL)= 0 1670 0.000033 gettimeofday({1430592206,952066},NULL)= 0 1670 0.000032 epoll_wait(155,{},100,100)= […]

与Apache负载平衡器的Socket.io 1.0粘滞会话

我一直在使用Apache作为我的Socket.io服务器的负载平衡器。 我经历了以下的话题,现在一切似乎都没有问题。 为Socket.IO 1.0configurationApache 2.4 mod_proxy_wstunnel 我使用以下configurationconfiguration了Apache,现在连接正在升级到WebSocket。 但是当我尝试为以下configuration启用粘性会话时,似乎有时候apache将路由升级请求路由到路由#2,同时在路由#1上build立轮询。 发生这种情况时,升级失败,websocket未连接。 因为我们必须使用平衡器(一个用于http,一个用于ws),所以我想也许http路由#1设置的cookie不能被ws路由访问,这就是为什么会话在http和ws之间不粘连的原因。 我使用的是Apache 2.4.9 <VirtualHost *:8080> Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED ProxyRequests off ServerName localhost <Proxy balancer://http-localhost/> BalancerMember http://localhost:8081 route=1 keepalive=On smax=1 connectiontimeout=10 retry=600 timeout=900 ttl=900 BalancerMember http://localhost:8082 route=2 keepalive=On smax=1 connectiontimeout=10 retry=600 timeout=900 ttl=900 ProxySet lbmethod=byrequests ProxySet stickysession=ROUTEID </Proxy> <Proxy balancer://ws-localhost/> BalancerMember ws://localhost:8081 route=1 keepalive=On […]

使用PHP 5.4.40 FPM / Worker,Apache服务器暂时在Amazon Linux上使用Apache 2.4.12停止服务请求

我们有一个apache服务器不断的服务请求,由于以下错误: (70007)The timeout specified has expired: [client xxx.xxx.xxx.xxx:33740] AH01075: Error dispatching request to : (polling), referer: https://www.google.com/ [proxy_fcgi:error] [pid 12363:tid 139906999342848] [client xxx.xxx.xxx.xxx:6318] AH01067: Failed to read FastCGI header 似乎不pipe我们做什么,这不断发生,我已经尝试在php.conf中设置超时: # # Cause the PHP interpreter to handle files with a .php extension. # RequestReadTimeout header=180 body=180 <FilesMatch \.php$> SetHandler "proxy:unix:/var/run/php-fpm/php5-fpm.sock|fcgi://127.0.0.1 timeout=1800 connectiontimeout=1800" </FilesMatch> <Proxy […]

ModSecurity规则不扫描URI

我很难创build一个新的安全2.5规则。 我的部署:Apache服务器,安装程序作为反向代理。 (所以apache的web服务器__并不承载网站,而是将请求代理给另一个服务器来回应networking请求。) Web服务器使用authentication令牌将网站URL重写为安全的URL。 75.75.75.75 – – [01/May/2015:10:55:14 -0400] "GET /record/example.svc/js HTTP/1.1" 200 1786 "https://example.org/example.aspx?XOW%5eLdz%3c2%2f1%2f42%2527kbmhtbffJfx%3e0%2527qpkf%5ejc%3e2%2527Cfruho%60uhpmXOW%5eLdz%3c2%2f1%2f42%2527RptsbfVQU%60Jfx%3e193%2527qpkf%5ejc%3e2%2527RptsbfVQU%60Ejqts%60Bihmc%60Mblf%3cSdrtfru%1fTbpqjmh" 问题: Modsecurity当前扫描URI。 由于随机URI的性质,已经产生了很多误报。 为了防止这种情况,我想豁免所有的URIs扫描。 由于重写,redirect和身份validation令牌都在Web服务器上生成(我们如何保留它),所以如何通知mod安全性这些头文件是合法的,而不是扫描它们? 75.75.75.75 – – [01/May/2015:10:55:52 -0400] "GET /thing.aspx?XOW%5eLdz%3c375%25cddnnd%60ttds%5ebt%60he%3c5%2f58328 HTTP/1.1" 200 15100 "https://example.org/example.aspx?XOW%5eLdz%3c2%2f1%2f42%2527kbmhtbffJfx%3e0%2527qpkf%5ejc%3e2%2527Cfruho%60uhpmXOW%5eLdz%3c2%2f1%2f42%2527RptsbfVQU%60Jfx%3e193%2527qpkf%5ejc%3e2%2527RptsbfVQU%60Ejqts%60Bihmc%60Mblf%3cSdrtfru%1fTbpqjmh" 75.75.75.75 – – [01/May/2015:10:55:52 -0400] "GET /example/example.svc/js HTTP/1.1" 200 1786 "https://example.org/example.aspx?XOW%5eLdz%3c375%25cddnnd%60ttds%5ebt%60he%3c5%2f58328"

Apache频繁挂起,需要重新启动才能重新工作

我有调整Apache的问题。 我目前的MPM事件configuration是 <IfModule mpm_event_module> ServerLimit 24 StartServers 8 MinSpareThreads 512 MaxSpareThreads 768 ThreadsPerChild 64 MaxRequestWorkers 1536 MaxConnectionsPerChild 5000 </IfModule> 如果我连续按ctrl + r在我的网站上为20秒阿帕奇挂起,我需要重新启动服务器在繁忙的交通时间也发生,通常在一天超过5次我面临停机。 我正在阅读论坛调整Apache MPM事件,但无法弄清楚。可以任何人请帮助解决这个问题,或build议在我当前的设置更改,以达到最佳性能而不挂apache。 我正在使用Ubuntu的一个亚马逊m3大型实例 服务器状态显示此类输出 Current Time: Monday, 22-Jun-2015 06:42:39 UTC Restart Time: Monday, 22-Jun-2015 06:20:47 UTC Parent Server Config. Generation: 1 Parent Server MPM Generation: 0 Server uptime: 21 minutes 52 seconds Server […]

如何在godaddy linux主机上使用htaccess删除.php扩展名

如何使用htaccess文件删除.php扩展名。 我已经尝试了很多代码(我在互联网上发现,但没有得到成功。内部服务器错误是定期显示,我正在使用Godaddy Linux主机。 此代码是我正在使用的最新版本。 <IfModule mod_rewrite.c> Options All -Indexes Options +FollowSymLinks -MultiViews RewriteEngine On RewriteBase / # Unless directory, remove trailing slash RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([^/]+)/$ http://a.sprybirds.com/$1 [R=301,L] # Redirect external .php requests to extensionless url RewriteCond %{THE_REQUEST} ^(.+)\.php([#?][^\ ]*)?\ HTTP/ RewriteRule ^(.+)\.php$ http://a.sprybirds.com/$1 [R=301,L] # Resolve .php file for extensionless php urls RewriteRule […]

为虚拟Windows IIS上托pipe的应用程序安装SSL证书

我目前正在运行安装了WebMin并运行Apache的Ubuntu 14.04。 我也运行Virt Manager来拥有虚拟化的Windows Server。 我想为在虚拟化Windows Server上的IIS内运行的应用程序设置SSL证书。 我不确定我应该在Linux服务器上还是在IIS中安装SSL证书。 有人可以请帮助指出我在正确的方向,我应该在哪里设置configuration?

LAMP | Ubuntu – Apache access.log显示奇怪的值

我正在Ubuntu 14.04上运行一个开发LAMP服务器。 今天我看了一下access.log,发现了很多这样的代码: ::1 – – [05/Jul/2015:01:24:14 +0200] "OPTIONS * HTTP/1.0" 200 110 "-" "Apache/2.4.7 (Ubuntu) OpenSSL/1.0.1f (internal dummy connection)" 还有更多的这些: 127.0.0.1 – – [05/Jul/2015:01:50:01 +0200] "POST / HTTP/1.1" 403 347 "-" "-" 我想知道是否这可能是由错误的RewriteRule引起的问题(我只是说自从7月5日以来大约有1500行,如上面的第二行),或者如果我应该深入了解潜在的入侵服务器或至less是试图去做。 你有什么意见? 谢谢 编辑 这可能是有用的: 进入Apache的error.log我发现: [Mon Jun 29 01:24:31.082231 2015] [rewrite:error] [pid 5311] [client 127.0.0.1:33583] AH00670: Options FollowSymLinks and SymLinksIfOwnerMatch are […]

预期的Apache ForceType / SetHandler没有响应

我试图强制apache处理文件(或文件的目录)作为php,无论文件扩展名。 该文件的链接应该如下, Http://mysitehere.info/sig2/name.png 我努力了, <FilesMatch “\.(jpg|jpeg|png|gif|swf|flv|ico)$”> SetHandler application/x-httpd-php </FilesMatch> 这不起作用,返回一个破损的图像图标,name.png文件名和一个404没有发现时,用sig2/name.png/ 我也试过了, <Files .+*^$[]()> ForceType application/x-httpd-php SetHandler application/x-httpd-php </Files> 我已经从ForceType Sethandler Code得到.htaccess文件内容为什么这个工作这返回与第一次尝试相同的结果。 只有404或一个破碎的图像。 我也试过了, <Files "name.png"> SetHandler application/x-httpd-php </Files> 这是“工作”,但它没有做它需要的。 通过name.png访问图像给我一个破碎的图像。 通过name.png/访问它name.png/出于某种原因,我不确定。 我已经确保AllowOverride All被设置在我的httpd.conf中,用于图像的目录。 <Directory /var/www/> Options Indexes FollowSymLinks AllowOverride All Require All Granted </Directory> 这应该足以让Sethandler或ForceType的工作,但我会承担,但我仍然不能得到我想要的效果。 请注意,我没有安装mod_rewrite到我的服务器。 另外值得注意的是,SetHandler和ForceType与<Files "name.png">使用时有相同的结果我正在运行PHP 5.5.9? 和最新版本的Apache2。 那么,我在做一些可怕的错误,或者我有一个sethandler所需的模块吗?