Articles of apache 2.4

在CentOS上升级apache 2.4.6到2.4.12

我们有以下服务器的细节,我们需要升级Apache 2.4.6到Apache 2.4.12 OS: CentOS 6 Apache : 2.4.6 PHP : 5.5 我知道如何从头安装2.4.12,但我只是想升级当前的Apache 2.4.12,因为我不想损失PHP设置和当前的Apache的其他设置。

Apache .htaccess规则中的特殊nginx热链接保护转换

在Apache中,我有以下反向重写规则,我希望在nginx中有这个规则。 我看到cookie或引用规则示例。 但是两者都没有结合,所以我不知道如何去做这件事。 <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTP_REFERER} !^$ [OR] RewriteCond %{HTTP_REFERER} !^http(s)?://(www.)?domain\.com.*$ [NC] RewriteCond %{HTTP_COOKIE} !^.*_.*$ RewriteRule \.(flv|jpg|jpeg|mp3|mpg|mp4|mov|wav|wmv|png|gif|swf|css|js|htc|woff|otf|eot|ttf)$ – [F,NS,L] </IfModule> 这是一个轻松的规则,允许空的引用,如果与一个已知的cookie发送(例如_ )。 但是当使用无效的域引用者时,它将拒绝没有设置cookie的访问。

将apache转发代理用户redirect到本地apache站点

我希望连接到我的apache代理的所有用户都被redirect到同一个服务器上托pipe的一个apache页面。 我很舒服代理重写,301s,proxypass等,但不知道如何将所有请求redirect到自我。 我在/etc/httpd/conf.d/proxy.conf中input了以下内容 ProxyRequests On ProxyVia On <Proxy *> Order deny,allow Deny from all Allow from internal.example.com </Proxy> 我需要做的只是添加一个重写规则到上面? 例如: RewriteEngine on RewriteRule . index.php [L]

使用Apache将ServerAlias根redirect到某个子目录

我有以下Apache VirtualHostconfiguration: <VirtualHost 192.0.2.1:80 [2001:DB8:4007:80d::200e]:80> ServerName app.example.com ServerAlias foo.example.com ServerAlias bar.example.com … other server aliases … ProxyPass / http://localhost:8080/ ProxyPassReverse / http://localhost:8080/ </VirtualHost> 我想(暂时)将http://foo.example.com/redirect到http://foo.example.com/path/foo/resource ,更一般地说: http://${sub}.example.com/ > http://${sub}.example.com/path/${sub}/resource 什么是最好的办法呢? 如果这是不可能的,我不介意为每个ServerAlias编写一个规则。

在Apache中修改LogFormat

我需要修改Apache中的LogFormat,以便添加X-Forwarded-For标头并logging客户端的真实IP。 我试图编辑在httpd.conf文件,但我然后发现LogFormat两个单独的部分。 所以我不确定它们是否是重复的,是否应该删除它们中的任何一个,我不知道要编辑哪一个,或者我应该编辑它们。 我需要一些build议。 这是第一部分: <IfModule log_config_module> LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined LogFormat "%h %l %u %t \"%r\" %>s %b" common CustomLog "logs/access_log" common <IfModule logio_module> LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio </IfModule> </IfModule> 第二部分: <IfModule mod_log_config.c> LogFormat "%h %l %u %t […]

ProxyPassMatch和mod_rewrite的操作顺序

我在Apache文件夹模式下遇到了Apache 2.4,PHP-FPM和Wordpress Multi用户的情况。 所有非* .php文件都可以在子文件夹中正常工作,就像主要的example.com/subblog/ url一样,但是任何带有.php的文件,如example.com/subblog/wp-login.php都会失败,并且File Not Found来自PHP-FPM。 mod_rewrite文件是: RewriteEngine On RewriteBase / RewriteRule ^index\.php$ – [L] # uploaded files RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L] # add a trailing slash to /wp-admin RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L] RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^ – [L] RewriteRule ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [PT] RewriteRule ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [PT] RewriteRule […]

Apache 2.4.7不接受RSA密码,但openssl

# apachectl -version Server version: Apache/2.4.7 (Ubuntu) Server built: Jul 22 2014 14:36:38 我已经configuration了SSLCipherSuite ( SSLCipherSuite HIGH:MEDIUM:!aNULL:!MD5 )的SSLCipherSuite HIGH:MEDIUM:!aNULL:!MD5 。 我也testing了各种组合。 我已经使用openssl ciphers检查了主机上可用的openssl ciphers ,并且有很多RSA密码。 这里是我的mod_ssl.so的依赖关系: # locate mod_ssl.so /usr/lib/apache2/modules/mod_ssl.so # ldd `locate mod_ssl.so` linux-vdso.so.1 => (0x00007fffb5dfe000) libssl.so.1.0.0 => /lib/x86_64-linux-gnu/libssl.so.1.0.0 (0x00007f915c0ba000) libcrypto.so.1.0.0 => /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 (0x00007f915bce0000) [… omitted libpthread and libc …] /usr/bin/openssl上的ldd对libssl和libcrypto(v 1.0.0)产生相同的依赖关系。 我无法使用RSA密码获得连接。 我检查了使用openssl […]

不能configuration两个子域apache 2.4

我正在尝试使用apache 2.4configuration两个子域,但似乎有一个问题,我无法解决。 这里是Apache的configuration文件 <VirtualHost *:80> ServerName www.subdomain1.myweb.com ServerAlias subdomain1.myweb.com DocumentRoot /srv/webapps/mywebapp <Directory /srv/webapps/mywebapp> AllowOverride all Options -MultiViews Require all granted </Directory> </VirtualHost> <VirtualHost *:80> ServerName www.subdomain2.myweb.com ServerAlias subdomain2.myweb.com DocumentRoot /srv/webapps/mywebapp2 <Directory /srv/webapps/mywebapp2> AllowOverride all Options -MultiViews Require all granted </Directory> 我试着定义ServerName,但没有解决问题: ServerName www.myweb.com 并尝试在VirtualHost中使用服务器IP,使用通配符,在VirtualHost标签中使用域…等等任何工作如需要: 重点是,Apache服务器subdomain1.myweb.com ,但subdomain.myweb.com不。 唯一的办法,我不能服务这两个子域它是设置最后一个: <VirtualHost *:80> ServerName www.myweb.com ServerAlias myweb.com DocumentRoot /srv/webapps/mywebapp2 […]

Apache随机崩溃

所以显然apache已经间歇性的崩溃了一夜之间,Apache的错误日志没有显示任何可疑的东西。 我将不得不重新启动我的服务器每次让Apache再次运行。 服务器仍然可以连接,只是apache似乎已经消失在我身上。 当我查看消息日志时,我注意到一大堆消息: Apr 29 14:46:08 test_web kernel: *BAD*gran_size: 8M chunk_size: 32M num_reg: 10 lose cover RAM: -18M Apr 29 14:46:08 test_web kernel: *BAD*gran_size: 8M chunk_size: 64M num_reg: 10 lose cover RAM: -18M Apr 29 14:46:08 test_web kernel: *BAD*gran_size: 8M chunk_size: 128M num_reg: 10 lose cover RAM: -10M Apr 29 14:46:08 test_web kernel: *BAD*gran_size: […]

无法使用Apache和Tomcat在端口80上运行GitLab

我使用Omnibus安装程序安装了GitLab。 目前它正在使用运行在端口81上的Nginx(与GitLab捆绑在一起)正常工作。我从端口80更改为端口81,因为我的Apache运行在端口80上。我还安装了Tomcat并运行在端口8080上,所以我更改了独angular兽端口到8081.所有这些工作正常。 以下是我更改的设置: /etc/gitlab/gitlab.rb # https://gitlab.com/gitlab-org/omnibus-gitlab/blob/629def0a7a26e7c2326566f0758d4a27857b52a3/README.md#configuring-the-external-url-for-gitlab external_url 'http://mysite.example.net:81' #https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md#tcp-ports-for-gitlab-services-are-already-taken unicorn['port'] = 8081 #https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md#storing-git-data-in-an-alternative-directory git_data_dir "/mnt/tank/gitlab" /var/opt/gitlab/gitlab-rails/etc/gitlab.yml production: &base # # 1. GitLab app settings # ========================== ## GitLab settings gitlab: ## Web server settings (note: host is the FQDN, do not include http://) host: mysite.example.net port: 81 https: false 不幸的是,我需要GitLab在80端口上运行。我尝试了几个Apache虚拟主机configuration。 我得到的唯一成功是我可以键入URL http://mysite.example.com/gitlab并获得一个404错误,但我看到该URL更改为http://mysite.example.com/users/sign_in 。 redirect导致gitlab被删除,但如果我把它放回来获取URL http://mysite.example.com/gitlab/users/sign_in我可以看到GitLablogin页面,虽然它都被抬起,因为没有的图像是正确的。 […]