<html><body bgcolor="#FFFFFF"><div>you need to set a cache key based on the hostname (or something dynamic) else you will serve caches content as (index.HTML) from site1 for site2 and site3... index requests&nbsp;<br><br><div>Regards,</div><div>--</div><div>Payam Tarverdyan Chychi</div><div>Network Engineer</div><div><br></div>Sent from my iPhone</div><div><br>On 2010-03-24, at 2:34 AM, <a href="mailto:Pekka.Panula@sofor.fi">Pekka.Panula@sofor.fi</a> wrote:<br><br></div><div></div><blockquote type="cite"><div><font size="2" face="sans-serif">Hi</font>
<br>
<br><font size="2" face="sans-serif">I am using nginx as reverse proxy and
i have several names pointing to reverse proxy and i am using proxy cache.
My backends are basic LAMP servers and IBM Lotus Domino servers.</font>
<br>
<br><font size="2" face="sans-serif">Just wondering whats wrong as i changed
domain to point my new nginx server and i am getting wrong content, i am
getting wrong virtual host index page.</font>
<br>
<br><font size="2" face="sans-serif">eg. i am trying to </font><a href="http://www.silverice.org/"><font size="2" face="sans-serif">http://www.silverice.org/</font></a><font size="2" face="sans-serif">
and i am getting content from </font><a href="http://www.etappi.com/"><font size="2" face="sans-serif">http://www.etappi.com/</font></a><font size="2" face="sans-serif">
they reside same LAMP-server. Looking my nginx configuration i cant find
anything wrong.</font>
<br><font size="2" face="sans-serif">both named points to new nginx reverse
proxy server. nginx version 0.7.65</font>
<br>
<br><font size="2" face="sans-serif">Here is example from my config:</font>
<br>
<br><font size="2" face="sans-serif">my main config, main parts:</font>
<br><font size="2" face="sans-serif">------------8&lt;--------------------------------</font>
<br><tt><font size="2">http {</font></tt>
<br><tt><font size="2">&nbsp; &nbsp; proxy_cache_path &nbsp;/usr/share/nginx/cache
&nbsp;levels=1:2 &nbsp; keys_zone=one:10m max_size=1G;</font></tt>
<br><tt><font size="2">&nbsp; &nbsp; proxy_temp_path &nbsp; /usr/share/nginx/tmp;</font></tt>
<br>
<br><tt><font size="2">&nbsp; &nbsp; proxy_cache_valid 200 302 5m;</font></tt>
<br><tt><font size="2">&nbsp; &nbsp; proxy_cache_valid 301 1h;</font></tt>
<br><tt><font size="2">&nbsp; &nbsp; proxy_cache_valid any 1m;</font></tt>
<br>
<br><tt><font size="2">&nbsp; &nbsp; &nbsp;proxy_cache one;</font></tt>
<br>
<br><tt><font size="2">&nbsp; &nbsp;gzip_http_version 1.1;</font></tt>
<br><tt><font size="2">&nbsp; &nbsp;gzip_vary &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;on;</font></tt>
<br><tt><font size="2">&nbsp; &nbsp;gzip_min_length &nbsp;1100;</font></tt>
<br><tt><font size="2">&nbsp; &nbsp;gzip_buffers &nbsp; &nbsp; 16 8k;</font></tt>
<br><tt><font size="2">&nbsp; &nbsp;gzip_disable "MSIE [1-6]\.(?!.*SV1)";</font></tt>
<br><tt><font size="2">&nbsp; &nbsp;gzip_proxied &nbsp; &nbsp; any;</font></tt>
<br><tt><font size="2">&nbsp; &nbsp;gzip_types &nbsp; &nbsp; &nbsp; text/css
text/plain application/atom+xml application/x-javascript application/xml
text/javascript application/xml+rss;</font></tt>
<br><tt><font size="2">&nbsp; &nbsp;gzip on;</font></tt>
<br>
<br><tt><font size="2">&nbsp; &nbsp;server_tokens off;</font></tt>
<br><tt><font size="2">&nbsp; &nbsp;client_header_timeout &nbsp;3m;</font></tt>
<br><tt><font size="2">&nbsp; &nbsp;send_timeout &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; 3m;</font></tt>
<br><tt><font size="2">&nbsp; &nbsp;client_header_buffer_size &nbsp; &nbsp;1k;</font></tt>
<br><tt><font size="2">&nbsp; &nbsp;large_client_header_buffers &nbsp;4 4k;</font></tt>
<br><tt><font size="2">&nbsp; &nbsp;output_buffers &nbsp; 1 32k;</font></tt>
<br><tt><font size="2">&nbsp; &nbsp;postpone_output &nbsp;1460;</font></tt>
<br><tt><font size="2">&nbsp; &nbsp;sendfile &nbsp; &nbsp; &nbsp; &nbsp;
on;</font></tt>
<br><tt><font size="2">&nbsp; &nbsp;tcp_nopush &nbsp; &nbsp; &nbsp; on;</font></tt>
<br><tt><font size="2">&nbsp; &nbsp;tcp_nodelay &nbsp; &nbsp; &nbsp;on;</font></tt>
<br><tt><font size="2">&nbsp; &nbsp;keepalive_timeout &nbsp;75 20;</font></tt>
<br><tt><font size="2">&nbsp; &nbsp;server_names_hash_bucket_size 128; #
this seems to be required for some vh</font></tt>
<br>
<br><tt><font size="2">&nbsp; &nbsp;log_format &nbsp;main &nbsp;'$remote_addr
- $remote_user [$time_local] $request '</font></tt>
<br><tt><font size="2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp;'"$status" $body_bytes_sent "$http_referer"
'</font></tt>
<br><tt><font size="2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp;'"$http_user_agent" "$http_x_forwarded_for"';</font></tt>
<br>
<br><tt><font size="2">&nbsp; &nbsp;proxy_redirect &nbsp; &nbsp; &nbsp; &nbsp;off;</font></tt>
<br><tt><font size="2">&nbsp; &nbsp;proxy_set_header &nbsp; &nbsp; &nbsp;Host
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $host;</font></tt>
<br><tt><font size="2">&nbsp; &nbsp;proxy_set_header &nbsp; &nbsp; &nbsp;X-Real-IP
&nbsp; &nbsp; &nbsp; &nbsp;$remote_addr;</font></tt>
<br><tt><font size="2">&nbsp; &nbsp;proxy_set_header &nbsp; &nbsp; &nbsp;X-Forwarded-For
&nbsp;$proxy_add_x_forwarded_for;</font></tt>
<br><tt><font size="2">&nbsp; &nbsp;proxy_connect_timeout 90;</font></tt>
<br><tt><font size="2">&nbsp; &nbsp;proxy_send_timeout &nbsp; &nbsp;90;</font></tt>
<br><tt><font size="2">&nbsp; &nbsp;proxy_read_timeout &nbsp; &nbsp;90;</font></tt>
<br>
<br><tt><font size="2">&nbsp; &nbsp;# default virtual host</font></tt>
<br><tt><font size="2">&nbsp; &nbsp; server {</font></tt>
<br><tt><font size="2">&nbsp; &nbsp; &nbsp; &nbsp; listen &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp;80 default;</font></tt>
<br><tt><font size="2">&nbsp; &nbsp; &nbsp; &nbsp; server_name &nbsp; &nbsp;
_;</font></tt>
<br>
<br><tt><font size="2">&nbsp; &nbsp; &nbsp; &nbsp; access_log &nbsp;/var/log/nginx/default-access.log
&nbsp;main;</font></tt>
<br>
<br><tt><font size="2">&nbsp; &nbsp; &nbsp; &nbsp; server_name_in_redirect
&nbsp;off;</font></tt>
<br>
<br><tt><font size="2">&nbsp; &nbsp; &nbsp; &nbsp; location / {</font></tt>
<br><tt><font size="2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; index index.html;</font></tt>
<br><tt><font size="2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; root &nbsp;/var/www/default/htdocs;</font></tt>
<br><tt><font size="2">&nbsp; &nbsp; &nbsp; &nbsp; }</font></tt>
<br><tt><font size="2">&nbsp; &nbsp;}</font></tt>
<br>
<br><tt><font size="2">&nbsp; &nbsp;# here resides my virtual host configurations</font></tt>
<br><tt><font size="2">&nbsp; &nbsp;include /etc/nginx/virtual-hosts/*;</font></tt>
<br>
<br><tt><font size="2">}</font></tt>
<br>
<br><tt><font size="2">and my virtual hosts under: /etc/nginx/virtual-hosts
-directory:</font></tt>
<br>
<br><tt><font size="2">they all look like this:</font></tt>
<br><a href="www.silverice.org:/"><tt><font size="2">www.silverice.org:</font></tt></a>
<br><tt><font size="2">--------------------------8&lt;----------------</font></tt>
<br><tt><font size="2"># redirect <a href="http://silverice.org">silverice.org</a> -&gt; </font></tt><a href="www.silverice.org"><tt><font size="2">www.silverice.org</font></tt></a>
<br><tt><font size="2">server {</font></tt>
<br><tt><font size="2">&nbsp; &nbsp;server_name <a href="http://silverice.org">silverice.org</a>;</font></tt>
<br><tt><font size="2">&nbsp; &nbsp;rewrite &nbsp; &nbsp; ^/(.*)$ </font></tt><a href="http://www.silverice.org/$1"><tt><font size="2">http://www.silverice.org/$1</font></tt></a><tt><font size="2">
permanent;</font></tt>
<br><tt><font size="2">}</font></tt>
<br>
<br><tt><font size="2">server {</font></tt>
<br><tt><font size="2">&nbsp; &nbsp;server_name &nbsp;</font></tt><a href="www.silverice.org"><tt><font size="2">www.silverice.org</font></tt></a><tt><font size="2">;</font></tt>
<br><tt><font size="2">&nbsp; &nbsp;access_log &nbsp; /somedirectory/www.silverice.org/www.silverice.org-access_log
combined;</font></tt>
<br><tt><font size="2">&nbsp; &nbsp;default_type text/html;</font></tt>
<br><tt><font size="2">&nbsp; &nbsp;root &nbsp; &nbsp; &nbsp; &nbsp; /usr/share/nginx/huolto;</font></tt>
<br>
<br><tt><font size="2">&nbsp; &nbsp;location / {</font></tt>
<br>
<br><tt><font size="2">&nbsp; &nbsp; &nbsp; proxy_pass </font></tt><a href="http://ip.add.re.ss/"><tt><font size="2">http://ip.add.re.ss</font></tt></a><tt><font size="2">;</font></tt>
<br>
<br><tt><font size="2">&nbsp; &nbsp; &nbsp; # manual maintenance window</font></tt>
<br><tt><font size="2">&nbsp; &nbsp; &nbsp; include /etc/nginx/maintenance.conf;</font></tt>
<br><tt><font size="2">&nbsp; &nbsp;}</font></tt>
<br>
<br><tt><font size="2">&nbsp; &nbsp;# custom errorpages</font></tt>
<br><tt><font size="2">&nbsp; &nbsp;include /etc/nginx/errorpages.conf;</font></tt>
<br>
<br><tt><font size="2">&nbsp; &nbsp;# general block rules, security rules,
etc</font></tt>
<br><tt><font size="2">&nbsp; &nbsp;include /etc/nginx/suojaus.conf;</font></tt>
<br><tt><font size="2">}</font></tt>
<br><tt><font size="2">-----------------------------8&lt;------------------</font></tt>
<br><tt><font size="2">And other virtual host like </font></tt><a href="www.etappi.com"><tt><font size="2">www.etappi.com</font></tt></a><tt><font size="2">
looks like that, except name and access log changed. </font></tt>
<br>
<br><tt><font size="2">How come when trying to load </font></tt><a href="www.silverice.org"><tt><font size="2">www.silverice.org</font></tt></a><tt><font size="2">
i am getting </font></tt><a href="www.etappi.com"><tt><font size="2">www.etappi.com</font></tt></a><tt><font size="2">
content, mainly index page comes from wrong site.</font></tt>
<br>
<br><tt><font size="2">Looking backend logs i cant find error there, nothing
has changed there, name based virtual host there, Apache v2.</font></tt>
<br><font size="2" face="sans-serif"><br>
Terveisin/Regards,<br>
 &nbsp; Pekka Panula, Sofor Oy - Jatkuvat palvelut<br>
</font></div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>nginx mailing list</span><br><span><a href="mailto:nginx@nginx.org">nginx@nginx.org</a></span><br><span><a href="http://nginx.org/mailman/listinfo/nginx">http://nginx.org/mailman/listinfo/nginx</a></span><br></div></blockquote></body></html>