我在Apache的日志文件中出现以下错误: [Sat Apr 13 18:11:07 2013] [error] [client xxxX] Premature end of script headers: index.php 我有一些想法可能会导致它,但我的应用程序是非常大的index.php是一切的入口点。 有什么办法来configurationApache或PHP来logging更多的信息,如回溯或完整的URI?
我在我的Web服务器上托pipe两个应用程序,一个是Drupal站点,另一个是Errbit安装,这是一个Ruby on Rails应用程序。 这些url看起来像这样: http://ourcompany.com http://errbit.ourcompany.com:3000 我想在第二个url上放弃:3000的需求,所以我们可以通过以下方式直接访问它: http://errbit.ourcompany.com 我不想redirect,我希望URL保持不变,没有端口号。 我以前使用下面的命令行命令来设置一些IP表重新configuration: sudo iptables -t nat -I PREROUTING -p tcp –dport 80 -j REDIRECT –to-ports 3000 sudo iptables -t nat -I OUTPUT -p tcp -d 127.0.0.1 –dport 80 -j REDIRECT –to-ports 3000 …工作得很好,因为旧服务器上没有运行Apache。 但是,这将导致端口80上的所有请求被redirect到端口3000,这意味着它将中断访问http://ourcompany.com 我如何设置? 有没有办法configurationIP表来允许这个,或者这将在Apache2configuration?
相同的Apache重写规则在VHost中工作(匹配),但不在“.htaccess”文件中: <VirtualHost *:80> ServerName 192.168.1.100 ServerAlias example.com DocumentRoot /test RewriteEngine On RewriteRule ^/test.html$ /test2.html RewriteLog "/tmp/rewrite.log" RewriteLogLevel 9 <Directory "/"> AllowOverride All </Directory> </VirtualHost> 重写日志: 192.168.1.10 – – [13/May/2013:16:19:31 +0100] [example.com/sid#7fd764555ed0][rid#7fd764ad9758/initial] (2) init rewrite engine with requested uri /test.html 192.168.1.10 – – [13/May/2013:16:19:31 +0100] [example.com/sid#7fd764555ed0][rid#7fd764ad9758/initial] (3) applying pattern '^/test.html$' to uri '/test.html' 192.168.1.10 – – […]
我有PHP应用程序使用pdf2htmlEX和HTMLpurifier将PDF文档转换为文本格式。 转换过程由几个步骤组成: 1.使用networking浏览器上传图书 2.使用pdf2htmlex将pdf转换为txt 3.使用HTMLPurifer处理txt文件 对于大多数的文件,一切正常,但对于一些文件有很多页面(超过230)第3步失败。 当HTMLpurifier处理页面时,会引发错误:“PHP致命错误:超过最大执行时间0秒”。 在我的configuration中,max_execution_time被设置为0.我已经将strace附加到了Apache进程,这里是终止前的输出: lstat("/tmp/books/3349/html/78.page", {st_mode=S_IFREG|0644, st_size=40165, …}) = 0 open("/tmp/books/3349/html/78.page", O_RDONLY) = 20 fstat(20, {st_mode=S_IFREG|0644, st_size=40165, …}) = 0 lseek(20, 0, SEEK_CUR) = 0 fstat(20, {st_mode=S_IFREG|0644, st_size=40165, …}) = 0 read(20, "<div class=\"pd w1 h1\"><div id=\"p"…, 8192) = 8192 read(20, "AACAsAQAAQFgCAAAgLAEAABCWAAAACEs"…, 8192) = 8192 read(20, "7\"><span class=\"_ _1f\"> </span>F"…, 8192) […]
我正在Fedora(14)上运行mod_pagespeed的Apache,我得到错误消息: [error] an unknown filter was not added: DEFLATE 很多。 我知道这是因为mod_deflate没有加载,但是这很好,我不想加载它(负载平衡器照顾gzipping等等,当web服务器上放气时,我们得到意想不到的结果) 但是我不知道它在哪里被引用,我用这个命令来查看/ etc / httpd中的所有文件 find . -type f -exec grep -li "deflate" {} \; 更新该命令也searchconf.d subdir – 我用类似的东西来查看所有的服务器上的.htaccess文件 find . -type f -name ".htaccess" -exec grep -li "deflate" {} \; 并且唯一的引用是在.conf文件中,并且它们用# (apache已经重新启动) 更新来注释掉 # LoadModule deflate_module modules/mod_deflate.so 我怎样才能find它被引用的地方,并删除它? 更新我试图运行a2enmod和a2dismod ,但没有这样的命令。 yum install a2dismod没有find任何安装。 这些命令的名称和/etc/apache2/mods-enabled了/etc/apache2/mods-enabled目录我只能在ubuntu上find,我不知道相当于fedora […]
我正在使用Apache2并命名虚拟主机从一个IP地址为两个不同的networkingexampletwo.com ( exampletwo.com和exampletwo.com )提供服务。 一个站点( exampleone.com应该是HTTP和HTTPS,而另一个站点( example2.com )应该只服务于HTTP。 到目前为止,我已经得到他们各自的HTTP网站按预期工作,我已经得到了HTTPS为它的目的网站工作 – 但是当我去https://exampletwo.com我被服务https://exampleone.com内容和安全警告。 我如何获得https://exampletwo.com请求被拒绝? <VirtualHost 1.2.3.4:80> ServerName exampleone.com ServerAlias *.exampleone.com DocumentRoot /var/www/exampleone.com <Directory /var/www/exampleone.com> Options MultiViews AllowOverride None Order allow,deny allow from all </Directory> CustomLog /var/log/apache2/exampleone.log combined </VirtualHost> <VirtualHost 1.2.3.4:80> ServerName exampletwo.com ServerAlias *.exampletwo.com DocumentRoot /var/www/exampletwo.com <Directory /var/www/exampletwo.com> Options MultiViews AllowOverride None Order allow,deny allow from all […]
如果URI以“admin-”模式启动,或者包含“admin / user / login”redirect到同一个uri的https,我该如何强制Apache 。 例如: 如果URI是: http://examplesite.com/admin-2dns24dw redirect到: https://examplesite.com/admin-2dns24dw 如果URI是: http://examplesite.com/en/admin/user/login/msg redirect到: https://examplesite.com/en/admin/user/login/msg 如果任何没有任何这种模式的https URI应该redirect到同一个URL http。 例如: 如果URI是: https://examplesite.com/fa/dashboard redirect到: http://examplesite.com/fa/dashboard **更新** 我试过了: RewriteCond %{HTTPS} !=on RewriteCond %{THE_REQUEST} admin-|admin/users/login [NC] RewriteRule ^(my) https://%{HTTP_HOST}%{REQUEST_URI} [NC,R=301,L] 但它没有奏效。 有什么问题?
AWS上有许多EC2服务器,在负载平衡器(ELB)后面运行apache。 每隔一段时间,一些IP地址会滥用EC2服务器上托pipe的API并导致拒绝服务。 我无法访问负载平衡器,所以我需要在服务器级别阻止访问。 我根据负载平衡器提供的X-Forwarded-For头来改变apache访问日志来显示IP(否则它只显示负载平衡器的IP),所以我可以识别这些IP并阻止它们(再次指定X- Forwarded-For)类似于: <Directory api_dir> SetEnvIF X-FORWARDED-FOR "1.1.1.1" DenyIP Order allow,deny allow from all deny from env=DenyIP </Directory> 但是,这仍然意味着我需要手动处理每个攻击,并且我的服务器因此遭受了一些停机时间。 推荐的方式是自动阻止重复HTTP调用的攻击,而不是基于IP,而是基于来自负载均衡器的Forwarded-For头。
Debian 6s从apt-get openssl仍然在0.9.8(2010),并不支持TLS 1.1和TLS 1.2。 有没有什么为什么我不应该更新到最新的稳定1.0.1e? 或者,您build议使用TLS 1.1 / 2支持哪个版本。
首先介绍一下我如何安装PHP,Apache和一些Apache模块: # apt-get -y install php5 php-pear libapache2-mod-php5 php-apc php5-mysql php5-mcrypt php5-xmlrpc php5-curl php5-imagick php5-gd php5-imap php5-pspell # apt-get -y install apache2 apache2-doc apache2-utils # a2enmod setenvif headers deflate filter expires rewrite include 而我的httpd.conf文件看起来像这样(即我已经基本禁用.htaccess,并具有在httpd.conf中的所有规则): <Directory /var/www/example.com/public> AllowOverride None […] </Directory> 考虑到它会给你一个如何设置我的networking服务器的基本想法,我想继续问问题: Apache在安装PHP的静态内容方面比较慢,这是真的吗? ( 我猜 ) 比方说,我的网站的根目录是'/var/www/example.com/public',我在'/var/www/example.com/public/uploads中有所有的静态内容(CSS,JS,图片) “; 如何克服问题(1),而不必将所有静态内容移动到没有安装PHP的服务器?