Articles of apache 2.2

如何防止响应缓慢的Tomcat使Apache缓慢响应?

我有一个网站,主要是由静态html页面偶尔ajax请求。 该网站在Apache上运行,ajax由Tomcat处理。 如果Tomcat的响应速度很慢(java无法连接到数据库服务器,或者只是需要很长时间来处理请求),它会导致整个站点停机:所有静态html页面都需要很长时间才能加载(相同与图像,CSS,JS)。 现在,如果我只是手动停止Tomcat的一切工作仍然正常 – 该网站是快速和响应,只是Ajax请求无法正常工作。 我怎样才能使响应慢的Tomcat不使用所有的Apache资源,所以静态页面总是可以工作,不pipeTomcat发生了什么事情? 在我的情况下,响应式html页面比不工作ajax更重要。 httpd.conf : Timeout 120 KeepAlive Off MaxKeepAliveRequests 100 KeepAliveTimeout 15 <IfModule prefork.c> StartServers 16 MinSpareServers 10 MaxSpareServers 40 ServerLimit 512 MaxClients 512 MaxRequestsPerChild 4000 </IfModule> workers.properties worker.worker1.port=8888 worker.worker1.reply_timeout=120000 worker.worker1.socket_timeout=150000 server.xml中 <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8081" /> <Connector port="8888" scheme="http" protocol="AJP/1.3" redirectPort="8889" minSpareThreads="100" maxThreads="400" connectionTimeout="20000" acceptorThreadCount="2"/>

如何停止对启用ssl的虚拟主机(Apache-SNI)启用非启用了SSL的虚拟主机的HTTPS请求

我希望标题清楚。 如何防止启用非ssl虚拟主机的HTTPS请求转到启用ssl的第一个虚拟主机(安装程序是Apache-SNI)。 例如,使用下面的缩写configuration, https://example.com ://example.com(非ssl虚拟主机)的请求由Apache在启用了ssl的vhost https://example.org 。 我想禁用这种行为,并可能回复相应的HTTP响应代码(不确定是什么)。 这可能不可能,但我想我会问。 # I actually have a SNI setup, but it's not demonstrated here. # I don't think it's relevant in this situation. NameVirtualHost *:80 NameVirtualHost *:443 <VirtualHost *:80> ServerName example.org </VirtualHost> <VirtualHost *:443> ServerName example.org </VirtualHost> <VirtualHost *:80> ServerName example.com </VirtualHost> 编辑:也许在第一个SSL虚拟主机的mod_rewrite规则?

Apache优雅重启和用户体验的影响

在生产服务器上执行Apache的graceful重启是安全的吗? 优雅的重新启动会产生什么效果?影响(如果有的话)会有什么影响? 是否会有任何不利影响(例如停工,即使是短时间)? 我已经考虑了以下资源,但是对用户的影响是什么还不清楚: find'apache2'的正常运行时间 http://httpd.apache.org/docs/2.2/stopping.html#graceful http://www.cyberciti.biz/faq/apache-making-changes-config-file-without-restarting/

Apache已弃用的SSLCertificateChainFile指令(AH02559)

最近我已经将Apache从2.2升级到2.4,我无法弄清楚如何弃用SSLCertificateChainFile指令。 错误: me@jessie:~$ sudo apache2ctl configtest AH02559: The SSLCertificateChainFile directive (/etc/apache2/sites-enabled/https.conf:103) is deprecated, SSLCertificateFile should be used instead Syntax OK 我目前的设置: SSLCertificateFile /etc/apache2/cert/ssl.crt SSLCertificateKeyFile /etc/apache2/cert/ssl.key SSLCertificateChainFile /etc/apache2/cert/sub.class1.server.sha2.ca.pem SSLCACertificateFile /etc/apache2/cert/ca.pem 证书由StartCOM签名。 手动说,现在整个链应该在一个文件,由SSLCertificateFile指令指定,但我不知道什么键和顺序我应该连接到这个文件。

如何拒绝Web访问某些文件?

我需要做一个有点奇怪的操作。 首先,我运行在Debian上,apache2(以用户www数据运行) 所以,我有简单的文本文件与.txt ot .ini,或任何扩展名,无关紧要。 这些文件位于具有如下结构的子文件夹中: www.example.com/folder1/car/foobar.txt www.example.com/folder1/cycle/foobar.txt www.example.com/folder1/fish/foobar.txt www.example.com/folder1/fruit/foobar 。文本 因此,文件名总是相同的,同样的“层次”,只是改变文件夹的名称:/folder-name-static/folder-name-dinamyc/file-name-static.txt 我应该做的是(我认为)相对简单:我必须能够通过服务器上的程序(例如python,php)读取该文件,但是如果我尝试通过broswer检索文件内容(digging the url www。 example.com/folder1/car/foobar.txt,或通过cUrl等)。我必须得到一个禁止的错误,或其他,但不能访问该文件 。 即使通过FTP访问这些文件也是很好的,但是无论如何也不能下载(至less我使用的是ftp root和用户数据) 我能怎么做? 我发现这个在线,被放在文件中.htaccess: <Files File.txt> Order allow, deny Deny from all </ Files> 它似乎工作,但只有当文件是在Web根目录(www.example.com / myfile.txt),而不是在子文件夹。 此外,第二级文件夹(www.example.com/folder1/ fruit / foob​​ar.txt)将dinamycally创build..我想避免不得不改变.htaccess文件不时。 可以创build一个类似的规则,这个规则适用于所有名称为*的文件,它位于* www.example.com / folder-name-static / * folder-name-dinamyc / ***文件名-static.txt *, 那些部分是相同的 ,只是**一个改变 ? 编辑 : 正如Dave […]

ProxyPass整个域到Tomcat,包括root

我已将VirtualHost example.comconfiguration为将所有请求都委托给Tomcat服务器 ProxyPass / http://localhost:8088/app ProxyPassReverse / http://localhost:8088/app 这适用于像example.com/page这样的URL,但是对于example.com和example.com/,我得到这个redirect响应,这显然导致什么都没有。 HTTP/1.1 302 Moved Temporarily Date: Wed, 06 Jul 2011 21:13:37 GMT Server: Apache-Coyote/1.1 <– the redirect comes from tomcat Location: http://example.com/app/ <– nonsense … 我能做些什么来解决它? 最好在Apacheconfiguration中。 我正在使用Apache 2和Tomcat 7

增加Apache中LimitRequestFieldSize的值

我开发了一个应用程序,它使用了一个jQuery插件,它反过来使用多余的cookie数据。 问题是每15-20个请求之后,我通过浏览器显示这个错误信息。 您的浏览器发送了此服务器无法理解的请求。 请求标头字段的大小超过服务器限制。 挖了四周后我才知道,默认情况下apache的cookie长度默认值大约是8190 bytes 。 并增加limit.i需要改变/添加下面的行到configuration指令。 LimitRequestFieldSize 16380 我试图在.htaccess添加上面的代码,并重新启动了Apache服务器,但它没有工作。 我很困惑在哪里放置这条线。 是在httpd.conf文件中,或者有无论如何,我可以增加使用.htaccess文件的限制。 如果有人能把我指向正确的方向,我将不胜感激。 顺便说一句,我在OSX 10.7.4使用MAMP。

在Amazon Linux上启用mod_rewrite

我试图在Amazon Linux实例上启用mod_rewrite。 我的目录指令如下所示: <Directory /> Order deny,allow Allow from all Options None AllowOverride None </Directory> <Directory "/var/www/vhosts"> Order allow,deny Allow from all Options None AllowOverride All </Directory> 然后进一步在httpd.conf我有LoadModule指令: … other modules… #LoadModule substitute_module modules/mod_substitute.so LoadModule rewrite_module modules/mod_rewrite.so #LoadModule proxy_module modules/mod_proxy.so … other modules… 我已经注释掉了Wordpress所不需要的所有Apache模块。 仍然当我发出HTTP重新启动,然后用/usr/sbin/httpd -l检查加载的模块时,我只能得到: [root@foobar]# /usr/sbin/httpd -l Compiled in modules: core.c prefork.c http_core.c […]

如何让所有的URL通过一个PHP文件运行?

如何在这些forms的url的MVC系统强制通过一个单一的index.php文件的所有请求? http://www.example.com/foo/bar/baz http://www.example.com/goo/car/caz/SEO-friendly-name-of-the-object http://www.example.com/hey/you 编辑:当我尝试下面的重写规则,我得到这个错误: [error] [client 127.0.0.1] Invalid URI in request GET / HTTP/1.1 [error] [client 127.0.0.1] Invalid URI in request GET /abc HTTP/1.1 编辑:哦,这是/index.php的完整内容。 当我删除重写规则时,它输出“/”或“/index.php”,或者我得到一个404其他任何东西。 <?php echo htmlspecialchars($_SERVER['REQUEST_URI']); ?> 求解:我在重写规则中的index.php前面添加了一个/然后它工作: 重新求解:结果只是因为我正在运行2.2.4。 当我升级到2.2.11时,/不再需要。

如何将Apache重写规则移植到切诺基?

对于切诺基来说,我相当陌生,除了URL Rewrites之外,它是非常棒的。 有一个简单的向导吗? 让我知道。 另外我将如何移植这个: RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?q=$1 [L,QSA] 谢谢