Articles of apache 2.2

Apacheredirect到查询string中提供的URI

假设Apache 2.x收到以下请求: http://myserver1.domain.com/auth?path=http://myserver2.domain.com/somepath 我如何让Apache生成一个redirect到path参数的值? 例如http://myserver2.domain.com/somepath

奇怪的只redirectSafari的iPad

我的Web服务器发生了最奇怪的事情。 这是Apache 2的SSL。 为了简化,这是为什么我的configuration看起来像(example.com指的是我自己的领域,当然): <VirtualHost *:80> ServerName example.com ServerAlias www.example.com Redirect 301 / https://example.com/ </VirtualHost> <VirtualHost *:443> ServerName example.com DocumentRoot /var/www/example … #options and allow/deny for directories … #logging settings SSLEngine on … #ssl settings </VirtualHost> <VirtualHost *:443> ServerName www.example.com Redirect 301 / https://example.com/ SSLEngine on … #ssl settings </VirtualHost> 实质上,它所做的是将所有非httpsstream量redirect到https,并将www.example.comredirect到example.com – 到目前为止,这么好。 这适用于所有平台上的所有浏览器 – […]

Apache和Ngnixconfiguration文件在修补时被replace

我在CentOS 6.x机器上使用Apache和Ngnix。 我碰到的问题是,当使用yum update来修补这些服务时,默认的configuration文件被重写到Apache的相应configuration目录( /etc/httpd/{conf,conf.d}中, /etc/nginx和/etc/nginx/conf.d Nginx的/etc/nginx/conf.d ),覆盖了我有意做的configuration更改。 我能想到的Web服务器configuration唯一的非标准部分是我已经删除了configuration文件: Apache etc/httpd/conf.d/ssl.conf Nginx /etc/nginx/conf.d/default.conf 并用其他名称不同的configuration文件replace它们。 更新后,这些文件重新出现,毫不奇怪,在这一点上configuration存在冲突。 有没有办法避免这一点,所以我不需要不断地重新检查configuration目录的内容? 或者我只需要忍受这个麻烦,并且每次修补后重新检查configuration。

如何正确设置虚拟主机

当我去www.example.fr时,我得到正确的DocumentRoot( /var/www/example/web ),但是当我尝试去example.fr时 ,它给了我默认的DocumentRoot( /var/www/ )。 我已经尝试了很多东西,但没有成功。 /etc/hosts : 51.254.122.31 example.fr /etc/apache2/sites-enabled/example.fr.conf : <VirtualHost *:80> ServerAdmin [email protected] ServerName example.fr ServerAlias www.example.fr DocumentRoot /var/www/example/web/ DirectoryIndex app.php <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <Directory "/usr/lib/cgi-bin"> AllowOverride None Options +ExecCGI […]

如何调整Apache只显示一个HTTPS协议的主机

我在FreeBSD上有一个Web服务器Apache,并且希望将SSL绑定到许多域中的一个。 现在我的configuration是 NameVirtualHost *:80 <VirtualHost *:80> DocumentRoot /home/web/web/domain01.com ServerName domain01.com ServerAlias www.domain01.com </VirtualHost> <VirtualHost *:80> DocumentRoot /home/web/web/ssldomain.com ServerName ssldomain.com ServerAlias www.ssldomain.com </VirtualHost> <VirtualHost *:443> DocumentRoot "/home/web/web/ssldomain.com" ServerName www.ssldomain.com ServerAlias ssldomain.com SSLEngine on SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL SSLCertificateFile "/usr/local/etc/apache22/ssl/www.ssldomain.com.crt" SSLCertificateKeyFile "/usr/local/etc/apache22/ssl/private.key" SSLCertificateChainFile "/usr/local/etc/apache22/ssl/intermediate.crt" </VirtualHost> 一切正常,但在浏览器上https://www.domain01.com/显示ssldomain.com网站的页面。 这是坏的。 如何调整Apache以防止在浏览器中显示https://www.domain01.com上的ssldomain.com页面。 UPD:我试图为这两个域定义VirtualHosts:80和:443。 1)将ssldomain.com的原始SSL用于两个域; 2)使用ssldomain.com的原始SSL和domain01.com的自签名SSL。 在这两种情况下,浏览器显示HTTPS上的证书错误,但页面是正确的。 configuration这两个案例 Include etc/apache22/extra/httpd-ssl.conf NameVirtualHost *:80 NameVirtualHost *:443 […]

fail2ban为apache访问日志

我已经尝试了所有从Apache访问日志中获取主机的方法,但都没有成功 我的基本testing方法如下: fail2ban-regex '87.97.244.57 – – [05/Nov/2015:12:46:24 -0500] "GET /index.php/?a=30%60%22( HTTP/1.1" 200 22639 "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)' '^<HOST> – – [[^]+] ".*60.20.*' 我试过^<HOST> – – [[^]+] ".*60.20.* <HOST> – – [[^]+] ".*60.20.* [[]client []].*60.20.* ^<HOST>.*60.20.*$ .*60.20.* …等 他们要么错过了目标行或者我得到一个错误fail2ban.server.failregex.RegexException: No 'host' group in […]

IP在地址栏中显示时,有一个子域到不同的IP

目前我在域名提供商有一个域名。 我设置为: NSlogging: example.com指向dns1.domainNameProvider.com logging: sub1.example.com指向xx.xx.xx.xx logging: sub2.example.com指向xx.xx.xx.xx logging: *.example.com指向xx.xx.xx.xx 一切都很好。 现在,我想将sub2.example.com放到不同的服务器yy.yy.yy.yy 我build立了一个新的服务器与Apache2和更新点3: logging: sub2.example.com指向yy.yy.yy.yy 但是现在当我转到sub2.example.com ,地址栏显示的是yy.yy.yy.yy而不是子域名sub2.example.com 。 是否有可能在不同的Web服务器上运行子域名? 如果是的话,我在哪里做错了,我该如何解决? 谢谢。

如何添加新的模块到Apache2 Centos6

当我编译Apache,我忘了添加proxy_http_module我现在怎么添加它? 我的apache安装在这里: /usr/local/apache2 我试图再次编译并得到这个错误: make[1]: Leaving directory `/root/httpd-2.2.31/support' make[1]: Entering directory `/root/httpd-2.2.31' /root/httpd-2.2.31/srclib/apr/libtool –silent –mode=compile gcc -g -O2 -pthread -I. -I/root/httpd-2.2.31/os/unix -I/root/httpd-2.2.31/server/mpm/prefork -I/root/httpd-2.2.31/modules/http -I/root/httpd-2.2.31/modules/filters -I/root/httpd-2.2.31/modules/proxy -I/root/httpd-2.2.31/include -I/root/httpd-2.2.31/modules/generators -I/root/httpd-2.2.31/modules/mappers -I/root/httpd-2.2.31/modules/database -I/root/httpd-2.2.31/srclib/apr/include -I/root/httpd-2.2.31/srclib/apr-util/include -I/root/httpd-2.2.31/server -I/root/httpd-2.2.31/modules/proxy/../generators -I/root/httpd-2.2.31/modules/ssl -I/root/httpd-2.2.31/modules/dav/main -fPIE -prefer-non-pic -static -c modules.c && touch modules.lo gcc -g -O2 -pthread -I. -I/root/httpd-2.2.31/os/unix -I/root/httpd-2.2.31/server/mpm/prefork -I/root/httpd-2.2.31/modules/http -I/root/httpd-2.2.31/modules/filters -I/root/httpd-2.2.31/modules/proxy -I/root/httpd-2.2.31/include -I/root/httpd-2.2.31/modules/generators […]

如何知道apache2服务器的内存泄漏在哪里

我有一个apache2服务器,最近似乎有内存泄漏。 我使用mod_wsgi在Python中编写服务器WEB服务。 起初我认为这是我的Python程序泄漏的内存。 但是在top命令之后,我找不到任何泄漏内存的进程。 这是我的top命令。 128 GB的内存使用。 但apache2进程只使用14.1 GB的内存,我找不到任何其他进程谁使用这样的大内存。 如何find它? top – 16:33:01 up 2 days, 22:20, 1 user, load average: 0.07, 0.03, 0.05 Tasks: 1975 total, 1 running, 1974 sleeping, 0 stopped, 0 zombie Cpu(s): 0.1%us, 0.1%sy, 0.0%ni, 99.8%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st Mem: 131987724k total, 131571384k used, 416340k free, 11068k buffers Swap: 999420k […]

502代理错误的Apache反向代理

以下是我的https代理虚拟主机conf <VirtualHost *:443> ServerAdmin [email protected] ServerName example.openjuice.co ProxyRequests off SSLEngine on SSLProxyEngine On SSLCertificateFile /etc/ssl/cert/certs/apache.crt SSLCertificateKeyFile /etc/ssl/cert/certs/apache.key <Proxy *> Order deny,allow Allow from all </Proxy> <Location /> ProxyPass https://localhost:3006/ ProxyPassReverse https://example.openjuice.co:3006/ </Location> </VirtualHost> 但是我得到错误 代理错误 代理服务器收到来自上游服务器的无效响应。 代理服务器无法处理请求GET /。 原因:从远程服务器读取错误 请帮助我