Articles of apache 2.2

如何将旧的HTTPS URLredirect到Apache上的新位置HTTPS?

我有很多旧的地址和服务器, https : //site1.example.com,https://foo.example.com等等。 我想停止有这么多的服务器和SSL证书,并将所有内容都移动到一个服务器和域。 旧的链接需要保持有效。 到目前为止,我已经将Web应用程序移动到一个新的服务器, https : //apps.example.com/name,https://apps.example.com/foo等等。 我想closures具有Apache(2.2)redirect的旧服务器: NameVirtualHost 123.123.123.123:80 NameVirtualHost 123.123.123.123:443 <VirtualHost 123.123.123.123:80> Servername site1.example.com redirect permanent / https://apps.example.com/site1 </VirtualHost> <VirtualHost 123.123.123.123:443> Servername site1.example.com redirect permanent / https://apps.example.com/site1 </VirtualHost> <VirtualHost 123.123.123.123:80> Servername site2.example.com redirect permanent / https://apps.example.com/site2 </VirtualHost> … 上述的工作,但这意味着我需要保持这个旧的硬件服务器打开。 作为一个testing,我已经把site1.example.com指向了apps.example.com(新的服务器)的IP地址,并且在Apache(2.4)conf中,我有: NameVirtualHost 234.234.234.234:80 NameVirtualHost 234.234.234.234:443 <VirtualHost 234.234.234.234:80> Servername site1.example.com redirect permanent […]

Apache:SSL和非SSL(没有VirtualHosts?)

我有一个Web服务器,并有两个文件夹,我想对待不同。 本地文件系统上的一个文件夹应该使用SSL,而另一个则不应该,例如: /path/to/ssl/site /path/to/nonssl/site 我已经查看了<Directory>参数,但不能在该级别禁用SSLEngine 。 [root@host /]# service httpd restart Stopping httpd: [ OK ] Starting httpd: Syntax error on line # of /some/config/file.conf: SSLEngine not allowed here 似乎使用<VirtualHost>给出了这种粒度,但我会使用相同的主机名,因此我有点困惑。 (匹配通配符*) # need to create a virtualhost for each Non-SSL folder? <VirtualHost *:80> SSLDisable … … </VirtualHost> # need to create a virtualhost for each […]

麻烦获取Apache 2.2的DEFLATE

我发现我的服务器没有提供压缩页面。 使用这个答案 ,我将以下内容添加到了我的httpd conf文件中: # Declare a "gzip" filter, it should run after all internal filters like PHP or SSI FilterDeclare gzip CONTENT_SET # "gzip" filter can change "Content-Length", can not be used with range requests FilterProtocol gzip change=yes;byteranges=no # Enable "gzip" filter if "Content-Type" contains "text/html", "text/css" etc. FilterProvider gzip DEFLATE resp=Content-Type $text/html FilterProvider […]

从Apache 2.4迁移到Apache 2.2时出现mod_rewrite错误

我有一个存储在我的网站的.htaccess文件中的重写规则列表,重写URL http://example.com/cloud/something到http://example.com/cloud/index.php?page=something 。 当我在Apache 2.4.7服务器上时,这些规则是完美的,但是我现在正在使用Apache 2.2.22(不是我的select)工作,出于某种原因,这些规则不起作用。 htaccess文件: RewriteEngine On RewriteBase /cloud/ RewriteCond %{THE_REQUEST} \ /+cloud/(?:index\.php|)\?page=([^&]+)/(&|\ |$) RewriteRule ^ %1/ [L,R] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.+)$ index.php?page=$1 [L,QSA] 每当我试图访问一个页面,其明确的URL( index.php?page=something ),它正在工作,但试图简短的方式导致404 Page Not Found响应。 我检查了Apache的error.log文件,看到每当我尝试访问这些URL之一时,都会出现一个新的错误: [error] [client 10.0.0.90] Negotiation: discovered file(s) matching request: /var/www/cloud/settings (None could be negotiated) 可能是什么问题? 为什么它不工作?

什么用户必须拥有apache日志目录

如果我为虚拟主机定义apache日志目录,我应该让所有者成为什么用户? 应该是apache用户,还是可以root的?

Tomcat8设置端口为80

我跟着这个http://www.mogilowski.net/lang/en-us/2014/04/22/install-apache-tomcat-8-on-debian-7-wheezy-with-virtual-hosts-and-apache2 -integrate /在VPS上安装tomcat,版本8.0.20 … 我试图改变港口80,但没有办法做到这一点,我曾尝试: http://beginlinux.com/server/ubuntu/changing-the-port-on-tomcat 但似乎没有工作,从日志里面的catalina.out得到这个错误: 25-Feb-2015 01:32:23.879 SEVERE [main] org.apache.catalina.core.StandardService.initInternal Failed to initialize connector [Connector[HTTP/1.1-$ org.apache.catalina.LifecycleException: Failed to initialize component [Connector[HTTP/1.1-80]] at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:106) at org.apache.catalina.core.StandardService.initInternal(StandardService.java:567) at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102) at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:851) at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102) at org.apache.catalina.startup.Catalina.load(Catalina.java:576) at org.apache.catalina.startup.Catalina.load(Catalina.java:599) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:310) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:484) Caused by: org.apache.catalina.LifecycleException: Protocol handler […]

没有VirtualHostfilter(一个好的做法?)

我试图找出当前设置的缺点,并发现一个潜在的exception。 有一个网页托pipe在(说) webpage.com 。 如果我将我的域(比如说) mydomain.com指向webpage.com的原始IP,则实际的webpage.com网页将在mydomain.com的Web请求上返回。 但这是一个很好的做法吗? VirtualHost(或SNI)是否应该在HTTP头中使用“主机”参数来过滤查询,这些参数在服务器上不存在?

如何禁用没有任何错误的ModSecurity

我已经在我的VPS上启用了Mod_Security,它使用apache web服务器运行Ubuntu操作系统。 现在,我想禁用它,因为我设置了另一个防火墙来保护我的服务器。 我已经尝试了以相反的顺序执行这些步骤(取出代码行和禁用模块),但是当我尝试重新启动Apache时,它一直说它无法重新启动。 我一直在寻找,但我无法find如何禁用WAF。 任何帮助,将不胜感激!

访问服务器与IP地址,而不是服务器名称

我试图访问我的服务器到以下地址: https://www.media-rewards.com/ 但它不工作:(。 但是,如果我使用它的IP地址,它的工作原理是: https://52.0.245.209/ 我不知道这两个问题是否有联系,但是:我可以访问defaut的apache页面(/var/www/html/index.html) http://52.0.245.209/ 我想redirect到https地址,我在Apacheconfiguration中尝试: <VirtualHost *:80> ServerName www.media-rewards.com Redirect permanent /var/www/html https://www.media-rewards.com/ </VirtualHost> <VirtualHost *:443> ServerName www.media-rewards.com Redirect permanent /var/www/html https://www.media-rewards.com/ </Virtualhost>

如果在文件夹中不存在文件,如何从根重写URI?

我有一个不在我的文档根目录的static文件夹。 我想redirect所有不存在于文档根目录但存在于静态文件夹中的文件。 (所以如果同一文件在两个地方,那么不在静态的文件将首先被提供。)我该怎么做? 以下不起作用: DocumentRoot /srv/app/client/build/ Alias / /srv/app/client/static RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_URI} !^/ RewriteRule ^(.*)$ /$1 <Location /> Order allow,deny Allow from all </Location>