<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[运维进行时]]></title> 
<link>https://blog.liuts.com/index.php</link> 
<description><![CDATA[互联网运维与架构]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[运维进行时]]></copyright>
<item>
<link>https://blog.liuts.com/post/149/</link>
<title><![CDATA[nginx虚拟目录(alias与root的区别)]]></title> 
<author>root &lt;admin@yourname.com&gt;</author>
<category><![CDATA[Nginx]]></category>
<pubDate>Thu, 22 Jan 2009 14:47:04 +0000</pubDate> 
<guid>https://blog.liuts.com/post/149/</guid> 
<description>
<![CDATA[ 
	&nbsp;&nbsp;&nbsp;&nbsp;nginx貌似没有虚拟目录的说法，因为它本来就是完完全全根据目录来设计并工作的。<br/>如果非要给nginx安上一个虚拟目录的说法，那就只有alias标签比较“像”，干脆来说说alias标签和root标签的区别吧。<br/>最基本的区别：alias指定的目录是准确的，root是指定目录的上级目录，并且该上级目录要含有location指定名称的同名目录。另外，根据前文所述，使用alias标签的目录块中不能使用rewrite的break。<br/>说不明白，看下配置：<br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content"><br/>location /abc/ &#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;alias /home/html/abc/;<br/>&#125;<br/></div></div><br/>在这段配置下，http://test/abc/a.html就指定的是/home/html/abc/a.html。这段配置亦可改成<br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content"><br/>location /abc/ &#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;root /home/html/;<br/>&#125;<br/></div></div><br/>这样，nginx就会去找/home/html/目录下的abc目录了，得到的结果是相同的。<br/>但是，如果我把alias的配置改成：<br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content"><br/>location /abc/ &#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;alias /home/html/def/;<br/>&#125;<br/></div></div><br/>那么nginx将会从/home/html/def/取数据，这段配置还不能直接使用root配置，如果非要配置，只有在/home/html/下建立一个 def->abc的软link（快捷方式）了。<br/>一般情况下，在location /中配置root，在location /other中配置alias是一个好习惯。<br/>至于alias和root的区别，我估计还没有说完全，如果在配置时发现奇异问题，不妨把这两者换换试试。<br/>原文：<a href="http://www.sudone.com/nginx/nginx_alias.html" target="_blank">http://www.sudone.com/nginx/nginx_alias.html</a><br/><br/>自己实践总结：<br/>1、使用alias时目录名后面一定要加“/”<br/>2、nginx、resin当虚拟目录名与真实目录同名时，虚拟目录比真实目录优先级要高。<br/>3、前端nginx的虚拟目录与后端resin真实目录同名时，后端resin真实目录优先级要高(即使resin也配制了同名的别名)。<br/>4、nginx+resin/tomcat整合过程中，发现Nginx的虚拟目录不能正确解析jsp，待解决。<br/><br/>Tags - <a href="https://blog.liuts.com/tags/%25E8%2599%259A%25E6%258B%259F%25E7%259B%25AE%25E5%25BD%2595/" rel="tag">虚拟目录</a>
]]>
</description>
</item><item>
<link>https://blog.liuts.com/post/142/</link>
<title><![CDATA[用Nginx配置https加密站点]]></title> 
<author>root &lt;admin@yourname.com&gt;</author>
<category><![CDATA[Nginx]]></category>
<pubDate>Thu, 22 May 2008 14:19:28 +0000</pubDate> 
<guid>https://blog.liuts.com/post/142/</guid> 
<description>
<![CDATA[ 
	<strong>一、Nginx安装</strong><br/>安装的时候需要注意加上 --with-http_ssl_module，因为http_ssl_module不属于Nginx的基本模块。<br/>Nginx安装方法：<br/>./configure --user=username --group=groupname --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module<br/>make && make install<br/><br/><strong>二、生成证书(略)</strong><br/>可以使用openssl或ca.ssl生成，结果生成如下两个文件：<br/>server.crt<br/>server.key<br/>如果是apache，直接将这两个文件引入到httpd.conf中，而Nginx需要的是.pem文件。.pem的生成方法很简单，就是合并server.crt、server.key的内容。<br/><br/><strong>三、修改Nginx配置</strong><br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content"><br/>server<br/>&#123;<br/> listen 443;<br/> server_name test.sina.com.cn;<br/> ssl on;<br/> ssl_certificate /tmp/server.pem;<br/> ssl_certificate_key /tmp/server.key;<br/> ssl_session_timeout 5m;<br/> ssl_protocols SSLv2 SSLv3 TLSv1;<br/> ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;<br/> ssl_prefer_server_ciphers on;<br/>&#125; <br/></div></div><br/>Tags - <a href="https://blog.liuts.com/tags/https/" rel="tag">https</a>
]]>
</description>
</item>
</channel>
</rss>