<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Apache on Shell&#39;s Home</title>
		<link>//blog.shell909090.org/tags/apache/</link>
		<description>Recent content in Apache on Shell&#39;s Home</description>
		<generator>Hugo</generator>
		<language>en-us</language>
		
		
		
			<copyright>CC-BY-SA4.0</copyright>
		
		
			<lastBuildDate>Fri, 02 Apr 2010 03:40:00 +0800</lastBuildDate>
		
			<atom:link href="//blog.shell909090.org/tags/apache/index.xml" rel="self" type="application/rss+xml" />
			<item>
				<title>以nginx作为subversion前端的一些细节</title>
				<link>//blog.shell909090.org/blog/archives/108/</link>
				<pubDate>Fri, 02 Apr 2010 03:40:00 +0800</pubDate>
				<guid>//blog.shell909090.org/blog/archives/108/</guid>
				<description>&lt;h1 id=&#34;location--50xhtml--root-varwwwnginx-default--&#34;&gt;本文系电脑资料，同步到blog上。小黄姐姐不必看了，可以帮我留个言。&#xA;nginx性能不错，可惜不支持WebDAV，因此没法拿来作为subversion的http服务。于是考虑开一个nginx作为前端，后端就跑一个apache来作为容器。配置这么写的(节选)：&#xA;=========/etc/nginx/sites-enabled/default========= server { listen  &#xA;443; server_name  OOXX ssl  on; ssl_certificate  keys/server.crt;&#xA;ssl_certificate_key  keys/server.key; ssl_session_timeout  5m;&#xA;ssl_protocols  SSLv2 SSLv3 TLSv1; ssl_ciphers &#xA;ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;&#xA;ssl_prefer_server_ciphers   on; access_log &#xA;/var/log/nginx/localhost.access.log; include            &#xA;/etc/nginx/mapping-ssl; error_page   500 502 503 504  /50x.html;&#xA;location = /50x.html { root   /var/www/nginx-default; } }&lt;/h1&gt;&#xA;&lt;h1 id=&#34;proxy_add_x_forwarded_for-&#34;&gt;打开了一个https的服务，这是当然的，svn传输的数据使用http很危险。&#xA;===========/etc/nginx/mapping-ssl============= location ^~ /svn {&#xA;proxy_set_header    Destination $http_destination;&#xA;proxy_pass          &lt;a href=&#34;http://apache_svr&#34;&gt;http://apache_svr&lt;/a&gt;; proxy_set_header   &#xA;Host            $host; proxy_set_header    X-Real-IP      &#xA;$remote_addr; proxy_set_header    X-Forwarded-Host $host;&#xA;proxy_set_header    X-Forwarded-Proto https; proxy_set_header   &#xA;X-Forwarded-Server $host; proxy_set_header    X-Forwarded-For&#xA;$proxy_add_x_forwarded_for; }&lt;/h1&gt;&#xA;&lt;h1 id=&#34;varwebsvnmainconfauthz-location&#34;&gt;将/svn下面的所有请求交给apache2。&#xA;=====/etc/apache2/mods-enabled/dav_svn.conf===== &amp;lt;Location&#xA;/svn/main&amp;gt; DAV svn SVNPath /var/web/svn/main AuthType Basic AuthName&#xA;&amp;ldquo;Subversion Repository&amp;rdquo; Require valid-user AuthUserFile&#xA;/var/web/svn/main/conf/passwd AuthzSVNAccessFile&#xA;/var/web/svn/main/conf/authz &amp;lt;/Location&amp;gt;&lt;/h1&gt;&#xA;&lt;h1 id=&#34;svn154-r33841tortoisesvn-15514361-neon0283&#34;&gt;看起来很美，但是在使用中会发生502错误，原因是来自文件移动后，svn会使用COPY作为Verb去请求服务器端，这时候发生了这样一条日志：&#xA;==========/var/log/apache2/access.log========== 127.0.0.1 - {user}&#xA;[02/Apr/2010:11:07:31 +0800] &amp;ldquo;COPY {path} HTTP/1.0&amp;rdquo; 502 546 &amp;ldquo;-&amp;rdquo;&#xA;&amp;ldquo;SVN/1.5.4 (r33841)/TortoiseSVN-1.5.5.14361 neon/0.28.3&amp;rdquo;&lt;/h1&gt;&#xA;&lt;p&gt;搜索了一下，这是因为使用https作为http服务的前端造成的，这里(&lt;a href=&#34;https://secure.bonkabonka.com/blog/2008/01/04/nginx_fronting_for_subversion.html)&#34;&gt;https://secure.bonkabonka.com/blog/2008/01/04/nginx_fronting_for_subversion.html)&lt;/a&gt;提到了解决方案，而它又引用了另一个网页(&lt;a href=&#34;http://silmor.de/49)&#34;&gt;http://silmor.de/49)&lt;/a&gt;解释细节。不幸的是，这个细节是错误的。关键在于这句上&#xA;LoadModule headers_module /usr/lib/apache2/modules/mod_headers_too.so&#xA;仔细看一下就会发现，mod_headers_too应当是mod_headers。在debian下，应当执行这几条指令。&#xA;cd /etc/apache2/mods-enabled ln -s ../mods-available/headers.load&#xA;headers.load 然后，在/etc/apache2/httpd.conf中写入以下内容：&#xA;RequestHeader edit Destination ^https http early 问题解决，Q.E.D。&lt;/p&gt;</description>
			</item>
			<item>
				<title>apache2服务器证书生成过程</title>
				<link>//blog.shell909090.org/blog/archives/272/</link>
				<pubDate>Tue, 06 Dec 2005 19:42:04 +0800</pubDate>
				<guid>//blog.shell909090.org/blog/archives/272/</guid>
				<description>&lt;p&gt;首先为 CA 创建一个 RSA 私用密钥&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;openssl genrsa -des3 -out ca.key 1024&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;利用 CA 的 RSA 密钥创建一个自签署的 CA 证书（X.509结构）&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;openssl req -new -x509 -days 3650 -key ca.key -out ca.crt&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;首先为你的 Apache 创建一个 RSA 私用密钥&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;openssl genrsa -des3 -out server.key 1024&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;用 server.key 生成证书签署请求 CSR&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;openssl req -new -key server.key -out server.csr&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;签署证书&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;openssl x509 -md5 -days 3560 -req -signkey server.key -CAcreateserial -CAserial ca.crt -in server.csr -out server.crt&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;最后apache设置，将下面的参数改为&lt;/p&gt;</description>
			</item>
			<item>
				<title>debian上配置基于apache2的resin</title>
				<link>//blog.shell909090.org/blog/archives/266/</link>
				<pubDate>Tue, 29 Nov 2005 00:26:52 +0800</pubDate>
				<guid>//blog.shell909090.org/blog/archives/266/</guid>
				<description>&lt;p&gt;别的不说了，先用debian自带的apt安装apache2,记得安装dev部分，还有libapr0,libapr-dev,libapr0-dev。千万别忘记安装后面的部分，否则你在下面编译的时候就要出现问题。&lt;/p&gt;&#xA;&lt;p&gt;拿到resin，放在目标目录下面，然后tar -jxvf。完成后用ln -s做一个链接上去，使用resin的名字，这样可以方便的替换版本。然后在主目录下面运行./configure，make一下。一般来说，会出不少错误，最后生成一个libresin.so放到libexec下面，并且更新了resin的主执行程序。这个so很具有迷惑性，开始贝壳就被他骗了。这个so貌似是resin在本地平台下的加速程序，而不是嵌入到apache系列服务器中的整合插件。其中最大的差异是没有caucho_module导出符号，在apache加载的时候肯定会失败。&lt;/p&gt;&#xA;&lt;p&gt;跑到src/c/plugins/apache2下面运行make。可能会报错，可能没有。贝壳这里报了错，不过贝壳运行configure的时候没有加任何参数，也许加了参数就正常了。如果不正常，出错的代码可能分别是httpd.h找不到或者apr_time.h找不到。运行vi Makefile，看到有INCLUDE的目录吗？那里面要包含/usr/include/apache2和/usr/include/apr-0两个目录，没有就肯定出错。好了，修改然后重新make。得到的文件是mod_caucho.so。将它cp到$RESIN_HOME/libexec下面，这个动态库导出了caucho_module符号。&lt;/p&gt;&#xA;&lt;p&gt;在/etc/apache2/httpd.conf里面编辑一下，添加这个内容。&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;LoadModule caucho_module /usr/resin/libexec/mod_caucho.so&#xA;&amp;lt;IfModule mod_caucho.c&amp;gt;&#xA;&#x9;CauchoConfigFile ......../resin.conf&#xA;&#x9;&amp;lt;Location /caucho-status&amp;gt;&#xA;&#x9;&#x9;SetHandler caucho-status&#xA;&#x9;&amp;lt;/Location&amp;gt;&#xA;&amp;lt;/IfModule&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;在/usr/resin/conf/resin.conf里面，添加这些内容。&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;doc-dir&amp;gt;/var/www/htdocs&amp;lt;/doc-dir&amp;gt;&#xA;&amp;lt;war-dir id=&#39;/var/www/htdocs&#39;/&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;在/etc/apache2/sites-available/default中可能要修改如下配置。&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;DocumentRoot /var/www/htdocs/&#xA;&amp;lt;Directory /var/www/htdocs/&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;然后注销&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;RedirectMatch ^/$ /apache2-default/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;OK，这样就基本完成了整个系统的整合配置。&lt;/p&gt;</description>
			</item>
	</channel>
</rss>
