<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xml:base="http://vladgh.com"  xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
 <title>VladGh.com blogs</title>
 <link>http://vladgh.com/blog</link>
 <description></description>
 <language>en</language>
<item>
 <title>Varnish 3 and Apache in Ubuntu 12.04 LTS Precise</title>
 <link>http://vladgh.com/blog/varnish-3-and-apache-ubuntu-1204-lts-precise</link>
 <description>&lt;div class=&quot;field field-name-body field-type-text-with-summary field-label-hidden&quot;&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot; property=&quot;content:encoded&quot;&gt;&lt;p&gt;This article is a Partner Post by the UK based PartyCasino.com. Being one of the best ranked Internet casinos, they offer various &lt;a href=&quot;http://www.partycasino.com/games/slots.html&quot;&gt;slot games&lt;/a&gt;. Even if I am not an avid player, I can admit that the revenue is tempting and I understand why this is such a fast growing and profitable industry.&lt;/p&gt;
&lt;p&gt;Varnish is an HTTP accelerator, which serves static content from disk or RAM memory. Unlike Squid or other similar software that was created to be mainly a proxy, Varnish has resolved the problems of having data in the virtual memory, and was created from ground up as an HTTP accelerator. It is also very configurable allowing a multitude of uses.&lt;/p&gt;
&lt;p&gt;You will probably ask how is this different from memcached, used in conjunction with nginx. The answer is that they are two completely different systems, varnish is an accelerator while memcached is an in-memory key-value store for small chunks of arbitrary data.&lt;/p&gt;
&lt;p&gt;Now let&#039;s install a typical LAMP system, that everybody blames as being slow and memory consuming. By simply adding varnish as a buffer in front of it, you will notice not only a more linear memory consumption but also an increase in the speed.&lt;/p&gt;
&lt;p&gt;
	We will start by installing MySQL:&lt;/p&gt;
&lt;div class=&quot;geshifilter&quot;&gt;
&lt;div class=&quot;bash geshifilter-bash&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;apt-get install&lt;/span&gt; mysql-server mysql-client&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
	Now bring the example configuration. The path might be different in your case though.&lt;/p&gt;
&lt;div class=&quot;geshifilter&quot;&gt;
&lt;div class=&quot;bash geshifilter-bash&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;cp&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-f&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;usr&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;share&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;doc&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;mysql-server-&lt;span style=&quot;color: #000000;&quot;&gt;5.5&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;examples&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;my-medium.cnf &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;etc&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;mysql&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;my.cnf&lt;br /&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;etc&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;init.d&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;mysql restart&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
	Install apache and enable a few modules:&lt;/p&gt;
&lt;div class=&quot;geshifilter&quot;&gt;
&lt;div class=&quot;bash geshifilter-bash&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;apt-get install&lt;/span&gt; apache2-mpm-prefork apache2-utils&lt;br /&gt;
a2enmod rewrite&lt;br /&gt;
a2enmod expires&lt;br /&gt;
a2enmod headers&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
	Slow it down by limiting the max clients in the /etc/apache2/apache2.conf file:&lt;/p&gt;
&lt;div class=&quot;geshifilter&quot;&gt;
&lt;div class=&quot;bash geshifilter-bash&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;lt;&lt;/span&gt;IfModule mpm_prefork_module&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;
        StartServers &lt;span style=&quot;color: #000000;&quot;&gt;10&lt;/span&gt;&lt;br /&gt;
        MinSpareServers &lt;span style=&quot;color: #000000;&quot;&gt;10&lt;/span&gt;&lt;br /&gt;
        MaxSpareServers &lt;span style=&quot;color: #000000;&quot;&gt;20&lt;/span&gt;&lt;br /&gt;
        ServerLimit &lt;span style=&quot;color: #000000;&quot;&gt;50&lt;/span&gt;&lt;br /&gt;
        MaxClients &lt;span style=&quot;color: #000000;&quot;&gt;50&lt;/span&gt;&lt;br /&gt;
        MaxRequestsPerChild &lt;span style=&quot;color: #000000;&quot;&gt;5000&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;lt;/&lt;/span&gt;IfModule&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
	Install PHP and a few extra modules, such as suhosin for increased security and APC, an opcode cache:&lt;/p&gt;
&lt;div class=&quot;geshifilter&quot;&gt;
&lt;div class=&quot;bash geshifilter-bash&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;apt-get install&lt;/span&gt; php5 php5-mysql libapache2-mod-php5 php5-suhosin php5-dev php-pear php5-curl php5-cli php5-gd php-apc&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
	Enable the APC engine:&lt;/p&gt;
&lt;div class=&quot;geshifilter&quot;&gt;
&lt;div class=&quot;bash geshifilter-bash&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;apc.enabled = 1&lt;br /&gt;
apc.shm_size = 128&lt;br /&gt;
apc.shm_segments=1&lt;br /&gt;
apc.write_lock = 1&lt;br /&gt;
apc.rfc1867 = On&lt;br /&gt;
apc.ttl=7200&lt;br /&gt;
apc.user_ttl=7200&lt;br /&gt;
apc.num_files_hint=1024&lt;br /&gt;
apc.mmap_file_mask=/tmp/apc.XXXXXX&lt;br /&gt;
apc.enable_cli=1&lt;br /&gt;
apc.slam_defense = Off&lt;br /&gt;
&quot;&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;etc&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;php5&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;conf.d&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;apc.ini&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
	And now Varnish:&lt;/p&gt;
&lt;div class=&quot;geshifilter&quot;&gt;
&lt;div class=&quot;bash geshifilter-bash&quot; style=&quot;font-family:monospace;&quot;&gt;curl http:&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;//&lt;/span&gt;repo.varnish-cache.org&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;debian&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;GPG-key.txt &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;apt-key add&lt;/span&gt; -&lt;br /&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;deb &lt;a href=&quot;http://repo.varnish-cache.org/debian/&quot;&gt;http://repo.varnish-cache.org/debian/&lt;/a&gt; lucid varnish-3.0&quot;&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;etc&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;apt&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;sources.list&lt;br /&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;apt-get update&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;apt-get install&lt;/span&gt; varnish&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
	Now, before you start the servers, let&#039;s adjust Apache and Varnish to work together. First change the default port for your virtual host in apache:&lt;/p&gt;
&lt;div class=&quot;geshifilter&quot;&gt;
&lt;div class=&quot;bash geshifilter-bash&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;vi&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;etc&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;apache2&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;sites-available&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;default&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
	Change from &lt;strong&gt;&amp;lt;VirtualHost *:&lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;80&lt;/span&gt;&amp;gt;&lt;/strong&gt; into &lt;strong&gt;&amp;lt;VirtualHost *:&lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;8008&lt;/span&gt;&amp;gt;&lt;/strong&gt; (this is just a preference)&lt;/p&gt;
&lt;p&gt;
	The configuration daemon for Varnish is located in /etc/default/varnish. Here you can pass the startup options:&lt;/p&gt;
&lt;div class=&quot;geshifilter&quot;&gt;
&lt;div class=&quot;bash geshifilter-bash&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #007800;&quot;&gt;DAEMON_OPTS&lt;/span&gt;=&lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;-a :80 &lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\&lt;br /&gt;&lt;/span&gt;             -T localhost:6082 &lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\&lt;br /&gt;&lt;/span&gt;             -f /etc/varnish/default.vcl &lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\&lt;br /&gt;&lt;/span&gt;             -S /etc/varnish/secret &lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\&lt;br /&gt;&lt;/span&gt;             -s malloc,256M &lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\&lt;br /&gt;&lt;/span&gt;             -u www-data &lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\&lt;br /&gt;&lt;/span&gt;             -g www-data&quot;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
	&lt;em&gt;&lt;strong&gt;-f /etc/varnish/default.vcl&lt;/strong&gt;&lt;/em&gt; is the configuration file, and &lt;em&gt;&lt;strong&gt;-s malloc,256M&lt;/strong&gt;&lt;/em&gt; means that I allowed Varnish to use 256M of my RAM. Further configurations are very well documented in the comments of this file. For me, setting Varnish to use the disk instead of the virtual memory wasn&#039;t too much of an improvement. Of course if you have more memory to spare, you can allow it to use more. &lt;em&gt;&lt;strong&gt;-a 80&lt;/strong&gt;&lt;/em&gt; is the port on which varnish listens, which is the default 80 (we want it in front of Apache), and &lt;em&gt;&lt;strong&gt;-T localhost:6082&lt;/strong&gt;&lt;/em&gt; is the administration panel.&lt;/p&gt;
&lt;p&gt;
	Now let&#039;s get to the configuration file (/etc/varnish/default.vcl). This is a very simple use of Varnish which strips the cookies of some static files, like jpg and png, allowing them to be cached. In my case this works best, and it also gives me a header information of what was cached and what not (if you check the headers with something like FireBug). Of course you can find even better configurations available. Having a specific configuration for your platform, like Drupal or WordPress, is not a bad thing either.&lt;/p&gt;
&lt;div class=&quot;geshifilter&quot;&gt;
&lt;div class=&quot;cpp geshifilter-cpp&quot; style=&quot;font-family:monospace;&quot;&gt;backend apache &lt;span style=&quot;color: #008000;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
  .&lt;span style=&quot;color: #007788;&quot;&gt;host&lt;/span&gt; &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;&quot;127.0.0.1&quot;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
  .&lt;span style=&quot;color: #007788;&quot;&gt;port&lt;/span&gt; &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;&quot;8008&quot;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
  .&lt;span style=&quot;color: #007788;&quot;&gt;connect_timeout&lt;/span&gt; &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; 600s&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
  .&lt;span style=&quot;color: #007788;&quot;&gt;first_byte_timeout&lt;/span&gt; &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; 600s&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
  .&lt;span style=&quot;color: #007788;&quot;&gt;between_bytes_timeout&lt;/span&gt; &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; 600s&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #008000;&quot;&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;acl purge &lt;span style=&quot;color: #008000;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
  &lt;span style=&quot;color: #FF0000;&quot;&gt;&quot;localhost&quot;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #008000;&quot;&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;acl ban &lt;span style=&quot;color: #008000;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
  &lt;span style=&quot;color: #FF0000;&quot;&gt;&quot;localhost&quot;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #008000;&quot;&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;sub vcl_recv &lt;span style=&quot;color: #008000;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
  &lt;span style=&quot;color: #666666;&quot;&gt;// Strip cookies for static files:&lt;/span&gt;&lt;br /&gt;
  &lt;span style=&quot;color: #0000ff;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;(&lt;/span&gt;req.&lt;span style=&quot;color: #007788;&quot;&gt;url&lt;/span&gt; ~ &lt;span style=&quot;color: #FF0000;&quot;&gt;&quot;\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|pdf|txt|tar|wav|bmp|rtf|js|flv|swf|html|htm|xml)$&quot;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
    unset req.&lt;span style=&quot;color: #007788;&quot;&gt;http&lt;/span&gt;.&lt;span style=&quot;color: #007788;&quot;&gt;Cookie&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
  &lt;span style=&quot;color: #008000;&quot;&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;  &lt;span style=&quot;color: #666666;&quot;&gt;// Remove specific cookies:&lt;/span&gt;&lt;br /&gt;
  set req.&lt;span style=&quot;color: #007788;&quot;&gt;http&lt;/span&gt;.&lt;span style=&quot;color: #007788;&quot;&gt;Cookie&lt;/span&gt; &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; regsuball&lt;span style=&quot;color: #008000;&quot;&gt;(&lt;/span&gt;req.&lt;span style=&quot;color: #007788;&quot;&gt;http&lt;/span&gt;.&lt;span style=&quot;color: #007788;&quot;&gt;Cookie&lt;/span&gt;, &lt;span style=&quot;color: #FF0000;&quot;&gt;&quot;has_js=[^;]+(; )?&quot;&lt;/span&gt;, &lt;span style=&quot;color: #FF0000;&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
  set req.&lt;span style=&quot;color: #007788;&quot;&gt;http&lt;/span&gt;.&lt;span style=&quot;color: #007788;&quot;&gt;Cookie&lt;/span&gt; &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; regsuball&lt;span style=&quot;color: #008000;&quot;&gt;(&lt;/span&gt;req.&lt;span style=&quot;color: #007788;&quot;&gt;http&lt;/span&gt;.&lt;span style=&quot;color: #007788;&quot;&gt;Cookie&lt;/span&gt;, &lt;span style=&quot;color: #FF0000;&quot;&gt;&quot;__utm.=[^;]+(; )?&quot;&lt;/span&gt;, &lt;span style=&quot;color: #FF0000;&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
  set req.&lt;span style=&quot;color: #007788;&quot;&gt;http&lt;/span&gt;.&lt;span style=&quot;color: #007788;&quot;&gt;Cookie&lt;/span&gt; &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; regsub&lt;span style=&quot;color: #008000;&quot;&gt;(&lt;/span&gt;req.&lt;span style=&quot;color: #007788;&quot;&gt;http&lt;/span&gt;.&lt;span style=&quot;color: #007788;&quot;&gt;Cookie&lt;/span&gt;, &lt;span style=&quot;color: #FF0000;&quot;&gt;&quot;^;\s*&quot;&lt;/span&gt;, &lt;span style=&quot;color: #FF0000;&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
  &lt;span style=&quot;color: #0000ff;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;(&lt;/span&gt;req.&lt;span style=&quot;color: #007788;&quot;&gt;http&lt;/span&gt;.&lt;span style=&quot;color: #007788;&quot;&gt;cookie&lt;/span&gt; ~ &lt;span style=&quot;color: #FF0000;&quot;&gt;&quot;^ *$&quot;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;{&lt;/span&gt; unset req.&lt;span style=&quot;color: #007788;&quot;&gt;http&lt;/span&gt;.&lt;span style=&quot;color: #007788;&quot;&gt;cookie&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
  &lt;span style=&quot;color: #0000ff;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;(&lt;/span&gt;req.&lt;span style=&quot;color: #007788;&quot;&gt;http&lt;/span&gt;.&lt;span style=&quot;color: #007788;&quot;&gt;Cookie&lt;/span&gt; ~ &lt;span style=&quot;color: #FF0000;&quot;&gt;&quot;^\s*$&quot;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;{&lt;/span&gt; unset req.&lt;span style=&quot;color: #007788;&quot;&gt;http&lt;/span&gt;.&lt;span style=&quot;color: #007788;&quot;&gt;Cookie&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
  &lt;span style=&quot;color: #0000ff;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;(&lt;/span&gt;req.&lt;span style=&quot;color: #007788;&quot;&gt;http&lt;/span&gt;.&lt;span style=&quot;color: #007788;&quot;&gt;Cookie&lt;/span&gt; &lt;span style=&quot;color: #000080;&quot;&gt;==&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;{&lt;/span&gt; &lt;span style=&quot;color: #0000dd;&quot;&gt;remove&lt;/span&gt; req.&lt;span style=&quot;color: #007788;&quot;&gt;http&lt;/span&gt;.&lt;span style=&quot;color: #007788;&quot;&gt;Cookie&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;  &lt;span style=&quot;color: #666666;&quot;&gt;// Normalize Accept-Encoding header (straight from the manual: &lt;a href=&quot;https://www.varnish-cache.org/docs/3.0/tutorial/vary.html&quot;&gt;https://www.varnish-cache.org/docs/3.0/tutorial/vary.html&lt;/a&gt;)&lt;/span&gt;&lt;br /&gt;
  &lt;span style=&quot;color: #0000ff;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;(&lt;/span&gt;req.&lt;span style=&quot;color: #007788;&quot;&gt;http&lt;/span&gt;.&lt;span style=&quot;color: #007788;&quot;&gt;Accept&lt;/span&gt;&lt;span style=&quot;color: #000040;&quot;&gt;-&lt;/span&gt;Encoding&lt;span style=&quot;color: #008000;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
    &lt;span style=&quot;color: #0000ff;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;(&lt;/span&gt;req.&lt;span style=&quot;color: #007788;&quot;&gt;url&lt;/span&gt; ~ &lt;span style=&quot;color: #FF0000;&quot;&gt;&quot;\.(jpg|png|gif|gz|tgz|bz2|tbz|mp3|ogg)$&quot;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
      &lt;span style=&quot;color: #666666;&quot;&gt;// No point in compressing these&lt;/span&gt;&lt;br /&gt;
      &lt;span style=&quot;color: #0000dd;&quot;&gt;remove&lt;/span&gt; req.&lt;span style=&quot;color: #007788;&quot;&gt;http&lt;/span&gt;.&lt;span style=&quot;color: #007788;&quot;&gt;Accept&lt;/span&gt;&lt;span style=&quot;color: #000040;&quot;&gt;-&lt;/span&gt;Encoding&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
    &lt;span style=&quot;color: #008000;&quot;&gt;}&lt;/span&gt; elsif &lt;span style=&quot;color: #008000;&quot;&gt;(&lt;/span&gt;req.&lt;span style=&quot;color: #007788;&quot;&gt;http&lt;/span&gt;.&lt;span style=&quot;color: #007788;&quot;&gt;Accept&lt;/span&gt;&lt;span style=&quot;color: #000040;&quot;&gt;-&lt;/span&gt;Encoding ~ &lt;span style=&quot;color: #FF0000;&quot;&gt;&quot;gzip&quot;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
      set req.&lt;span style=&quot;color: #007788;&quot;&gt;http&lt;/span&gt;.&lt;span style=&quot;color: #007788;&quot;&gt;Accept&lt;/span&gt;&lt;span style=&quot;color: #000040;&quot;&gt;-&lt;/span&gt;Encoding &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;&quot;gzip&quot;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
    &lt;span style=&quot;color: #008000;&quot;&gt;}&lt;/span&gt; elsif &lt;span style=&quot;color: #008000;&quot;&gt;(&lt;/span&gt;req.&lt;span style=&quot;color: #007788;&quot;&gt;http&lt;/span&gt;.&lt;span style=&quot;color: #007788;&quot;&gt;Accept&lt;/span&gt;&lt;span style=&quot;color: #000040;&quot;&gt;-&lt;/span&gt;Encoding ~ &lt;span style=&quot;color: #FF0000;&quot;&gt;&quot;deflate&quot;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
      set req.&lt;span style=&quot;color: #007788;&quot;&gt;http&lt;/span&gt;.&lt;span style=&quot;color: #007788;&quot;&gt;Accept&lt;/span&gt;&lt;span style=&quot;color: #000040;&quot;&gt;-&lt;/span&gt;Encoding &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;&quot;deflate&quot;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
    &lt;span style=&quot;color: #008000;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
      &lt;span style=&quot;color: #666666;&quot;&gt;// unkown algorithm&lt;/span&gt;&lt;br /&gt;
      &lt;span style=&quot;color: #0000dd;&quot;&gt;remove&lt;/span&gt; req.&lt;span style=&quot;color: #007788;&quot;&gt;http&lt;/span&gt;.&lt;span style=&quot;color: #007788;&quot;&gt;Accept&lt;/span&gt;&lt;span style=&quot;color: #000040;&quot;&gt;-&lt;/span&gt;Encoding&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
    &lt;span style=&quot;color: #008000;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
  &lt;span style=&quot;color: #008000;&quot;&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;  &lt;span style=&quot;color: #0000ff;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;(&lt;/span&gt;req.&lt;span style=&quot;color: #007788;&quot;&gt;restarts&lt;/span&gt; &lt;span style=&quot;color: #000080;&quot;&gt;==&lt;/span&gt; &lt;span style=&quot;color: #0000dd;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
    &lt;span style=&quot;color: #0000ff;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;(&lt;/span&gt;req.&lt;span style=&quot;color: #007788;&quot;&gt;http&lt;/span&gt;.&lt;span style=&quot;color: #007788;&quot;&gt;x&lt;/span&gt;&lt;span style=&quot;color: #000040;&quot;&gt;-&lt;/span&gt;forwarded&lt;span style=&quot;color: #000040;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
      set req.&lt;span style=&quot;color: #007788;&quot;&gt;http&lt;/span&gt;.&lt;span style=&quot;color: #007788;&quot;&gt;X&lt;/span&gt;&lt;span style=&quot;color: #000040;&quot;&gt;-&lt;/span&gt;Forwarded&lt;span style=&quot;color: #000040;&quot;&gt;-&lt;/span&gt;For &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; req.&lt;span style=&quot;color: #007788;&quot;&gt;http&lt;/span&gt;.&lt;span style=&quot;color: #007788;&quot;&gt;X&lt;/span&gt;&lt;span style=&quot;color: #000040;&quot;&gt;-&lt;/span&gt;Forwarded&lt;span style=&quot;color: #000040;&quot;&gt;-&lt;/span&gt;For&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
    &lt;span style=&quot;color: #008000;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
      set req.&lt;span style=&quot;color: #007788;&quot;&gt;http&lt;/span&gt;.&lt;span style=&quot;color: #007788;&quot;&gt;X&lt;/span&gt;&lt;span style=&quot;color: #000040;&quot;&gt;-&lt;/span&gt;Forwarded&lt;span style=&quot;color: #000040;&quot;&gt;-&lt;/span&gt;For &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; client.&lt;span style=&quot;color: #007788;&quot;&gt;ip&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
    &lt;span style=&quot;color: #008000;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
  &lt;span style=&quot;color: #008000;&quot;&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;  &lt;span style=&quot;color: #0000ff;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;(&lt;/span&gt;req.&lt;span style=&quot;color: #007788;&quot;&gt;request&lt;/span&gt; &lt;span style=&quot;color: #000040;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;&quot;GET&quot;&lt;/span&gt; &lt;span style=&quot;color: #000040;&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;br /&gt;
    req.&lt;span style=&quot;color: #007788;&quot;&gt;request&lt;/span&gt; &lt;span style=&quot;color: #000040;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;&quot;HEAD&quot;&lt;/span&gt; &lt;span style=&quot;color: #000040;&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;br /&gt;
    req.&lt;span style=&quot;color: #007788;&quot;&gt;request&lt;/span&gt; &lt;span style=&quot;color: #000040;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;&quot;PUT&quot;&lt;/span&gt; &lt;span style=&quot;color: #000040;&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;br /&gt;
    req.&lt;span style=&quot;color: #007788;&quot;&gt;request&lt;/span&gt; &lt;span style=&quot;color: #000040;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;&quot;POST&quot;&lt;/span&gt; &lt;span style=&quot;color: #000040;&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;br /&gt;
    req.&lt;span style=&quot;color: #007788;&quot;&gt;request&lt;/span&gt; &lt;span style=&quot;color: #000040;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;&quot;TRACE&quot;&lt;/span&gt; &lt;span style=&quot;color: #000040;&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;br /&gt;
    req.&lt;span style=&quot;color: #007788;&quot;&gt;request&lt;/span&gt; &lt;span style=&quot;color: #000040;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;&quot;OPTIONS&quot;&lt;/span&gt; &lt;span style=&quot;color: #000040;&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;br /&gt;
    req.&lt;span style=&quot;color: #007788;&quot;&gt;request&lt;/span&gt; &lt;span style=&quot;color: #000040;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;&quot;DELETE&quot;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
      &lt;span style=&quot;color: #ff0000; font-style: italic;&quot;&gt;/* Non-RFC2616 or CONNECT which is weird. */&lt;/span&gt;&lt;br /&gt;
      &lt;span style=&quot;color: #0000ff;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;(&lt;/span&gt;pipe&lt;span style=&quot;color: #008000;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
  &lt;span style=&quot;color: #008000;&quot;&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;  &lt;span style=&quot;color: #0000ff;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;(&lt;/span&gt;req.&lt;span style=&quot;color: #007788;&quot;&gt;request&lt;/span&gt; &lt;span style=&quot;color: #000040;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;&quot;GET&quot;&lt;/span&gt; &lt;span style=&quot;color: #000040;&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; req.&lt;span style=&quot;color: #007788;&quot;&gt;request&lt;/span&gt; &lt;span style=&quot;color: #000040;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;&quot;HEAD&quot;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
    &lt;span style=&quot;color: #ff0000; font-style: italic;&quot;&gt;/* We only deal with GET and HEAD by default */&lt;/span&gt;&lt;br /&gt;
    &lt;span style=&quot;color: #0000ff;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;(&lt;/span&gt;pass&lt;span style=&quot;color: #008000;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
  &lt;span style=&quot;color: #008000;&quot;&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;  &lt;span style=&quot;color: #0000ff;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;(&lt;/span&gt;req.&lt;span style=&quot;color: #007788;&quot;&gt;http&lt;/span&gt;.&lt;span style=&quot;color: #007788;&quot;&gt;Authorization&lt;/span&gt; &lt;span style=&quot;color: #000040;&quot;&gt;||&lt;/span&gt; req.&lt;span style=&quot;color: #007788;&quot;&gt;http&lt;/span&gt;.&lt;span style=&quot;color: #007788;&quot;&gt;Cookie&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
    &lt;span style=&quot;color: #ff0000; font-style: italic;&quot;&gt;/* Not cacheable by default */&lt;/span&gt;&lt;br /&gt;
    &lt;span style=&quot;color: #0000ff;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;(&lt;/span&gt;pass&lt;span style=&quot;color: #008000;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
  &lt;span style=&quot;color: #008000;&quot;&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;  &lt;span style=&quot;color: #0000ff;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;(&lt;/span&gt;req.&lt;span style=&quot;color: #007788;&quot;&gt;request&lt;/span&gt; &lt;span style=&quot;color: #000080;&quot;&gt;==&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;&quot;PURGE&quot;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
    &lt;span style=&quot;color: #0000ff;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #000040;&quot;&gt;!&lt;/span&gt;client.&lt;span style=&quot;color: #007788;&quot;&gt;ip&lt;/span&gt; ~ purge&lt;span style=&quot;color: #008000;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
      error &lt;span style=&quot;color: #0000dd;&quot;&gt;405&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;&quot;Not allowed.&quot;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
    &lt;span style=&quot;color: #008000;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
    &lt;span style=&quot;color: #0000ff;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;(&lt;/span&gt;lookup&lt;span style=&quot;color: #008000;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
  &lt;span style=&quot;color: #008000;&quot;&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;  &lt;span style=&quot;color: #0000ff;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;(&lt;/span&gt;req.&lt;span style=&quot;color: #007788;&quot;&gt;request&lt;/span&gt; &lt;span style=&quot;color: #000080;&quot;&gt;==&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;&quot;BAN&quot;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
    &lt;span style=&quot;color: #0000ff;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #000040;&quot;&gt;!&lt;/span&gt;client.&lt;span style=&quot;color: #007788;&quot;&gt;ip&lt;/span&gt; ~ ban&lt;span style=&quot;color: #008000;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
      error &lt;span style=&quot;color: #0000dd;&quot;&gt;405&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;&quot;Not allowed.&quot;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
    &lt;span style=&quot;color: #008000;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
    ban&lt;span style=&quot;color: #008000;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;&quot;req.http.host == &quot;&lt;/span&gt; &lt;span style=&quot;color: #000040;&quot;&gt;+&lt;/span&gt; req.&lt;span style=&quot;color: #007788;&quot;&gt;http&lt;/span&gt;.&lt;span style=&quot;color: #007788;&quot;&gt;host&lt;/span&gt; &lt;span style=&quot;color: #000040;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;&quot;&amp;amp;&amp;amp; req.url == &quot;&lt;/span&gt; &lt;span style=&quot;color: #000040;&quot;&gt;+&lt;/span&gt; req.&lt;span style=&quot;color: #007788;&quot;&gt;url&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
    error &lt;span style=&quot;color: #0000dd;&quot;&gt;200&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;&quot;Ban added&quot;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
  &lt;span style=&quot;color: #008000;&quot;&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;  &lt;span style=&quot;color: #0000ff;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;(&lt;/span&gt;lookup&lt;span style=&quot;color: #008000;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #008000;&quot;&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;sub vcl_pipe &lt;span style=&quot;color: #008000;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
  set bereq.&lt;span style=&quot;color: #007788;&quot;&gt;http&lt;/span&gt;.&lt;span style=&quot;color: #007788;&quot;&gt;connection&lt;/span&gt; &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;&quot;close&quot;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
  &lt;span style=&quot;color: #0000ff;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;(&lt;/span&gt;pipe&lt;span style=&quot;color: #008000;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #008000;&quot;&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;sub vcl_pass &lt;span style=&quot;color: #008000;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
  &lt;span style=&quot;color: #0000ff;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;(&lt;/span&gt;pass&lt;span style=&quot;color: #008000;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #008000;&quot;&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;sub vcl_hash &lt;span style=&quot;color: #008000;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
  hash_data&lt;span style=&quot;color: #008000;&quot;&gt;(&lt;/span&gt;req.&lt;span style=&quot;color: #007788;&quot;&gt;url&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
  &lt;span style=&quot;color: #0000ff;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;(&lt;/span&gt;req.&lt;span style=&quot;color: #007788;&quot;&gt;http&lt;/span&gt;.&lt;span style=&quot;color: #007788;&quot;&gt;host&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
    hash_data&lt;span style=&quot;color: #008000;&quot;&gt;(&lt;/span&gt;req.&lt;span style=&quot;color: #007788;&quot;&gt;http&lt;/span&gt;.&lt;span style=&quot;color: #007788;&quot;&gt;host&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
  &lt;span style=&quot;color: #008000;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
    hash_data&lt;span style=&quot;color: #008000;&quot;&gt;(&lt;/span&gt;server.&lt;span style=&quot;color: #007788;&quot;&gt;ip&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
  &lt;span style=&quot;color: #008000;&quot;&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;  &lt;span style=&quot;color: #666666;&quot;&gt;// If the client supports compression, keep that in a different cache&lt;/span&gt;&lt;br /&gt;
  &lt;span style=&quot;color: #0000ff;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;(&lt;/span&gt;req.&lt;span style=&quot;color: #007788;&quot;&gt;http&lt;/span&gt;.&lt;span style=&quot;color: #007788;&quot;&gt;Accept&lt;/span&gt;&lt;span style=&quot;color: #000040;&quot;&gt;-&lt;/span&gt;Encoding&lt;span style=&quot;color: #008000;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
    hash_data&lt;span style=&quot;color: #008000;&quot;&gt;(&lt;/span&gt;req.&lt;span style=&quot;color: #007788;&quot;&gt;http&lt;/span&gt;.&lt;span style=&quot;color: #007788;&quot;&gt;Accept&lt;/span&gt;&lt;span style=&quot;color: #000040;&quot;&gt;-&lt;/span&gt;Encoding&lt;span style=&quot;color: #008000;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
  &lt;span style=&quot;color: #008000;&quot;&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;  &lt;span style=&quot;color: #0000ff;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;(&lt;/span&gt;hash&lt;span style=&quot;color: #008000;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #008000;&quot;&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;sub vcl_hit &lt;span style=&quot;color: #008000;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
  &lt;span style=&quot;color: #0000ff;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;(&lt;/span&gt;req.&lt;span style=&quot;color: #007788;&quot;&gt;request&lt;/span&gt; &lt;span style=&quot;color: #000080;&quot;&gt;==&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;&quot;PURGE&quot;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
    purge&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
    error &lt;span style=&quot;color: #0000dd;&quot;&gt;200&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;&quot;Purged.&quot;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
  &lt;span style=&quot;color: #008000;&quot;&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;  &lt;span style=&quot;color: #666666;&quot;&gt;//Listen to browser force refresh&lt;/span&gt;&lt;br /&gt;
  &lt;span style=&quot;color: #0000ff;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;(&lt;/span&gt;req.&lt;span style=&quot;color: #007788;&quot;&gt;http&lt;/span&gt;.&lt;span style=&quot;color: #007788;&quot;&gt;Cache&lt;/span&gt;&lt;span style=&quot;color: #000040;&quot;&gt;-&lt;/span&gt;Control ~ &lt;span style=&quot;color: #FF0000;&quot;&gt;&quot;no-cache&quot;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
    &lt;span style=&quot;color: #0000ff;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #000040;&quot;&gt;!&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;(&lt;/span&gt;req.&lt;span style=&quot;color: #007788;&quot;&gt;http&lt;/span&gt;.&lt;span style=&quot;color: #007788;&quot;&gt;Via&lt;/span&gt; &lt;span style=&quot;color: #000040;&quot;&gt;||&lt;/span&gt; req.&lt;span style=&quot;color: #007788;&quot;&gt;http&lt;/span&gt;.&lt;span style=&quot;color: #007788;&quot;&gt;User&lt;/span&gt;&lt;span style=&quot;color: #000040;&quot;&gt;-&lt;/span&gt;Agent ~ &lt;span style=&quot;color: #FF0000;&quot;&gt;&quot;bot|MSIE&quot;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
      set obj.&lt;span style=&quot;color: #007788;&quot;&gt;ttl&lt;/span&gt; &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; 0s&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
      &lt;span style=&quot;color: #0000ff;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;(&lt;/span&gt;restart&lt;span style=&quot;color: #008000;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
    &lt;span style=&quot;color: #008000;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
  &lt;span style=&quot;color: #008000;&quot;&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;  &lt;span style=&quot;color: #0000ff;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;(&lt;/span&gt;deliver&lt;span style=&quot;color: #008000;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #008000;&quot;&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;sub vcl_miss &lt;span style=&quot;color: #008000;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
  &lt;span style=&quot;color: #0000ff;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;(&lt;/span&gt;req.&lt;span style=&quot;color: #007788;&quot;&gt;request&lt;/span&gt; &lt;span style=&quot;color: #000080;&quot;&gt;==&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;&quot;PURGE&quot;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
    purge&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
    error &lt;span style=&quot;color: #0000dd;&quot;&gt;200&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;&quot;Purged.&quot;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
  &lt;span style=&quot;color: #008000;&quot;&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;  &lt;span style=&quot;color: #0000ff;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;(&lt;/span&gt;fetch&lt;span style=&quot;color: #008000;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #008000;&quot;&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;sub vcl_fetch &lt;span style=&quot;color: #008000;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
  &lt;span style=&quot;color: #0000ff;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;(&lt;/span&gt;beresp.&lt;span style=&quot;color: #007788;&quot;&gt;ttl&lt;/span&gt; &lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;=&lt;/span&gt; 0s &lt;span style=&quot;color: #000040;&quot;&gt;||&lt;/span&gt;&lt;br /&gt;
    beresp.&lt;span style=&quot;color: #007788;&quot;&gt;http&lt;/span&gt;.&lt;span style=&quot;color: #007788;&quot;&gt;Set&lt;/span&gt;&lt;span style=&quot;color: #000040;&quot;&gt;-&lt;/span&gt;Cookie &lt;span style=&quot;color: #000040;&quot;&gt;||&lt;/span&gt;&lt;br /&gt;
    beresp.&lt;span style=&quot;color: #007788;&quot;&gt;http&lt;/span&gt;.&lt;span style=&quot;color: #007788;&quot;&gt;Vary&lt;/span&gt; &lt;span style=&quot;color: #000080;&quot;&gt;==&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;&quot;*&quot;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
      set beresp.&lt;span style=&quot;color: #007788;&quot;&gt;ttl&lt;/span&gt; &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0000dd;&quot;&gt;120&lt;/span&gt; s&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
      &lt;span style=&quot;color: #0000ff;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;(&lt;/span&gt;hit_for_pass&lt;span style=&quot;color: #008000;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
  &lt;span style=&quot;color: #008000;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
  &lt;span style=&quot;color: #0000ff;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;(&lt;/span&gt;deliver&lt;span style=&quot;color: #008000;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #008000;&quot;&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;sub vcl_deliver &lt;span style=&quot;color: #008000;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
  &lt;span style=&quot;color: #666666;&quot;&gt;// Debugging&lt;/span&gt;&lt;br /&gt;
  &lt;span style=&quot;color: #0000ff;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;(&lt;/span&gt;obj.&lt;span style=&quot;color: #007788;&quot;&gt;hits&lt;/span&gt; &lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #0000dd;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
    set resp.&lt;span style=&quot;color: #007788;&quot;&gt;http&lt;/span&gt;.&lt;span style=&quot;color: #007788;&quot;&gt;X&lt;/span&gt;&lt;span style=&quot;color: #000040;&quot;&gt;-&lt;/span&gt;Cache &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;&quot;HIT&quot;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
  &lt;span style=&quot;color: #008000;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
    set resp.&lt;span style=&quot;color: #007788;&quot;&gt;http&lt;/span&gt;.&lt;span style=&quot;color: #007788;&quot;&gt;X&lt;/span&gt;&lt;span style=&quot;color: #000040;&quot;&gt;-&lt;/span&gt;Cache &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;&quot;MISS&quot;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
  &lt;span style=&quot;color: #008000;&quot;&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;  &lt;span style=&quot;color: #666666;&quot;&gt;// Remove some headers: PHP version&lt;/span&gt;&lt;br /&gt;
  unset resp.&lt;span style=&quot;color: #007788;&quot;&gt;http&lt;/span&gt;.&lt;span style=&quot;color: #007788;&quot;&gt;X&lt;/span&gt;&lt;span style=&quot;color: #000040;&quot;&gt;-&lt;/span&gt;Powered&lt;span style=&quot;color: #000040;&quot;&gt;-&lt;/span&gt;By&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;  &lt;span style=&quot;color: #666666;&quot;&gt;// Remove some headers: Apache version &amp;amp; OS&lt;/span&gt;&lt;br /&gt;
  unset resp.&lt;span style=&quot;color: #007788;&quot;&gt;http&lt;/span&gt;.&lt;span style=&quot;color: #007788;&quot;&gt;Server&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;  &lt;span style=&quot;color: #0000ff;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;(&lt;/span&gt;deliver&lt;span style=&quot;color: #008000;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #008000;&quot;&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;sub vcl_error &lt;span style=&quot;color: #008000;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
  set obj.&lt;span style=&quot;color: #007788;&quot;&gt;http&lt;/span&gt;.&lt;span style=&quot;color: #007788;&quot;&gt;Content&lt;/span&gt;&lt;span style=&quot;color: #000040;&quot;&gt;-&lt;/span&gt;Type &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;&quot;text/html; charset=utf-8&quot;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
  set obj.&lt;span style=&quot;color: #007788;&quot;&gt;http&lt;/span&gt;.&lt;span style=&quot;color: #007788;&quot;&gt;Retry&lt;/span&gt;&lt;span style=&quot;color: #000040;&quot;&gt;-&lt;/span&gt;After &lt;span style=&quot;color: #000080;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;&quot;5&quot;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
  synthetic &lt;span style=&quot;color: #008000;&quot;&gt;{&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;&quot;&lt;br /&gt;
&amp;lt;?xml version=&quot;&lt;/span&gt;&lt;span style=&quot;color:#800080;&quot;&gt;1.0&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;&quot; encoding=&quot;&lt;/span&gt;utf&lt;span style=&quot;color: #000040;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #0000dd;&quot;&gt;8&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;&quot;?&amp;gt;&lt;br /&gt;
&amp;lt;!DOCTYPE html PUBLIC &quot;&lt;/span&gt;&lt;span style=&quot;color: #000040;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;//W3C//DTD XHTML 1.0 Strict//EN&quot;&lt;/span&gt;&lt;br /&gt;
 &lt;span style=&quot;color: #FF0000;&quot;&gt;&quot;&lt;a href=&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&amp;quot;&quot;&gt;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;html&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;
  &lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;head&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;
    &lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;title&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;&quot;} + obj.status + &quot;&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;&quot; + obj.response + {&quot;&lt;/span&gt;&lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000040;&quot;&gt;/&lt;/span&gt;title&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;
  &lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000040;&quot;&gt;/&lt;/span&gt;head&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;
  &lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;body&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;
    &lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;h1&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt;Error &lt;span style=&quot;color: #FF0000;&quot;&gt;&quot;} + obj.status + &quot;&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;&quot; + obj.response + {&quot;&lt;/span&gt;&lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000040;&quot;&gt;/&lt;/span&gt;h1&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;
    &lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;p&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;&quot;} + obj.response + {&quot;&lt;/span&gt;&lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000040;&quot;&gt;/&lt;/span&gt;p&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;
    &lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;h3&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt;Guru Meditation&lt;span style=&quot;color: #008080;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000040;&quot;&gt;/&lt;/span&gt;h3&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;
    &lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;p&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt;XID&lt;span style=&quot;color: #008080;&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;&quot;} + req.xid + {&quot;&lt;/span&gt;&lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000040;&quot;&gt;/&lt;/span&gt;p&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;
    &lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;hr&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;
    &lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;p&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt;Varnish cache server&lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000040;&quot;&gt;/&lt;/span&gt;p&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;
  &lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000040;&quot;&gt;/&lt;/span&gt;body&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #000080;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000040;&quot;&gt;/&lt;/span&gt;html&lt;span style=&quot;color: #000080;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;&quot;};&lt;br /&gt;
  return (deliver);&lt;br /&gt;
}&lt;/p&gt;
&lt;p&gt;sub vcl_init {&lt;br /&gt;
  return (ok);&lt;br /&gt;
}&lt;/p&gt;
&lt;p&gt;sub vcl_fini {&lt;br /&gt;
  return (ok);&lt;br /&gt;
}&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
	You can make sure that it works by checking the headers for: &lt;u&gt;&lt;em&gt;&lt;strong&gt;Via - 1.1 Varnish&lt;/strong&gt;&lt;/em&gt;&lt;/u&gt;&lt;/p&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;field field-name-field-tags field-type-taxonomy-term-reference field-label-inline clearfix&quot;&gt;&lt;h3 class=&quot;field-label&quot;&gt;Tags: &lt;/h3&gt;&lt;ul class=&quot;links inline&quot;&gt;&lt;li class=&quot;taxonomy-term-reference-0&quot;&gt;&lt;a href=&quot;/tags/ubuntu&quot; typeof=&quot;skos:Concept&quot; property=&quot;rdfs:label skos:prefLabel&quot; datatype=&quot;&quot;&gt;Ubuntu&lt;/a&gt;&lt;/li&gt;&lt;li class=&quot;taxonomy-term-reference-1&quot;&gt;&lt;a href=&quot;/tags/varnish&quot; typeof=&quot;skos:Concept&quot; property=&quot;rdfs:label skos:prefLabel&quot; datatype=&quot;&quot;&gt;Varnish&lt;/a&gt;&lt;/li&gt;&lt;li class=&quot;taxonomy-term-reference-2&quot;&gt;&lt;a href=&quot;/tags/apache&quot; typeof=&quot;skos:Concept&quot; property=&quot;rdfs:label skos:prefLabel&quot; datatype=&quot;&quot;&gt;Apache&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;</description>
 <pubDate>Mon, 06 Aug 2012 23:33:31 +0000</pubDate>
 <dc:creator>Vlad</dc:creator>
 <guid isPermaLink="false">20 at http://vladgh.com</guid>
</item>
<item>
 <title>Nagios with NginX in Ubuntu</title>
 <link>http://vladgh.com/blog/nagios-nginx-ubuntu</link>
 <description>&lt;div class=&quot;field field-name-body field-type-text-with-summary field-label-hidden&quot;&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot; property=&quot;content:encoded&quot;&gt;&lt;p&gt;In this article I will show you how I installed the latest version of the Nagios from sources, and how to serve it with NginX. Nagios is an open-source monitoring application with a very strong community and a huge set of plugins that can help you monitor every aspect of your servers. At the time of writing this article the latest version is 3.4.1. The platform used is Ubuntu Precise 12.04 LTS,  but except dependencies, it should be the same for older distributions. It doesn&#039;t hurt to check them first.&lt;/p&gt;
&lt;p&gt;We will start by installing the dependencies:&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;geshifilter&quot;&gt;&lt;code class=&quot;bash geshifilter-bash&quot;&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;apt-get install&lt;/span&gt; libperl-dev libpng12-dev libgd2-xpm-dev&lt;/code&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;And then create the user and group under which it will run:&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;geshifilter&quot;&gt;&lt;code class=&quot;bash geshifilter-bash&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;usr&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;sbin&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;useradd &lt;span style=&quot;color: #660033;&quot;&gt;-M&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-s&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;bin&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;false&lt;/span&gt; nagios&lt;/code&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Go ahead and create a directory in which we can download and compile the packages:&lt;/p&gt;
&lt;div class=&quot;geshifilter&quot;&gt;
&lt;div class=&quot;bash geshifilter-bash&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;mkdir&lt;/span&gt; nagios_sources &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;cd&lt;/span&gt; nagios_sources&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;wget&lt;/span&gt; http:&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;//&lt;/span&gt;prdownloads.sourceforge.net&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;sourceforge&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;nagios&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;nagios-3.4.1.tar.gz&lt;br /&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;wget&lt;/span&gt; http:&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;//&lt;/span&gt;prdownloads.sourceforge.net&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;sourceforge&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;nagiosplug&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;nagios-plugins-1.4.15.tar.gz&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;tar&lt;/span&gt; xzf nagios-3.4.1.tar.gz&lt;br /&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;tar&lt;/span&gt; xzf nagios-plugins-1.4.15.tar.gz&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;As you can see we downloaded both the core packages and the plugins. Next we will install the main program. I will use as the destination directory &quot;/opt/&quot;:&lt;/p&gt;
&lt;div class=&quot;geshifilter&quot;&gt;
&lt;div class=&quot;bash geshifilter-bash&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;cd&lt;/span&gt; nagios-3.2.3&lt;/p&gt;
&lt;p&gt;.&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;configure &lt;span style=&quot;color: #660033;&quot;&gt;--prefix&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;opt&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;nagios \&lt;br /&gt;&lt;span style=&quot;color: #660033;&quot;&gt;--sysconfdir&lt;/span&gt;=&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;etc&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;nagios \&lt;br /&gt;&lt;span style=&quot;color: #660033;&quot;&gt;--with-nagios-user&lt;/span&gt;=nagios \&lt;br /&gt;&lt;span style=&quot;color: #660033;&quot;&gt;--with-nagios-group&lt;/span&gt;=nagios \&lt;br /&gt;&lt;span style=&quot;color: #660033;&quot;&gt;--with-command-user&lt;/span&gt;=nagios \&lt;br /&gt;&lt;span style=&quot;color: #660033;&quot;&gt;--with-command-group&lt;/span&gt;=nagios&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;make&lt;/span&gt; all&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;make&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;install&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;make&lt;/span&gt; install-init&lt;br /&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;make&lt;/span&gt; install-config&lt;br /&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;make&lt;/span&gt; install-commandmode&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Next step is to create a password file:&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;geshifilter&quot;&gt;&lt;code class=&quot;bash geshifilter-bash&quot;&gt;htpasswd &lt;span style=&quot;color: #660033;&quot;&gt;-c&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;etc&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;nagios&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;htpasswd.users nagiosadmin&lt;/code&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Next we will install the plugins:&lt;/p&gt;
&lt;div class=&quot;geshifilter&quot;&gt;
&lt;div class=&quot;bash geshifilter-bash&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;cd&lt;/span&gt; ..&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;nagios-plugins-1.4.15&lt;/p&gt;
&lt;p&gt;.&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;configure &lt;span style=&quot;color: #660033;&quot;&gt;--prefix&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;opt&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;nagios \&lt;br /&gt;&lt;span style=&quot;color: #660033;&quot;&gt;--with-nagios-user&lt;/span&gt;=nagios \&lt;br /&gt;&lt;span style=&quot;color: #660033;&quot;&gt;--with-nagios-group&lt;/span&gt;=nagios&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;make&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;make&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;install&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Before we finish the installation you need to associate your email address with the nagiosadmin contact in the &lt;strong&gt;/etc/nagios/objects/contacts.cfg&lt;/strong&gt; file.&lt;/p&gt;
&lt;p&gt;That&#039;s it! The only thing left is to create the start-up links for Ubuntu, to test the configuration and if everything works, start the daemon:&lt;/p&gt;
&lt;div class=&quot;geshifilter&quot;&gt;
&lt;div class=&quot;bash geshifilter-bash&quot; style=&quot;font-family:monospace;&quot;&gt;update-rc.d &lt;span style=&quot;color: #660033;&quot;&gt;-f&lt;/span&gt; nagios defaults&lt;br /&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;opt&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;nagios&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;bin&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;nagios &lt;span style=&quot;color: #660033;&quot;&gt;-v&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;etc&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;nagios&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;nagios.cfg&lt;br /&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;etc&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;init.d&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;nagios start&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The &lt;strong&gt;/etc/nagios/objects/&lt;/strong&gt; folder contains all the definitions pertaining your monitored machines and you can change them any way you like. Everything is very well commented so it&#039;s very easy to modify it. But before restarting the server check first with the command above if everything works as expected.&lt;/p&gt;
&lt;p&gt;Now, for the nginx configuration, first of all apart from a functional php environment you must also have the lightweight fcgiwrap package from Ubuntu. You can install it with:&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;geshifilter&quot;&gt;&lt;code class=&quot;bash geshifilter-bash&quot;&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;apt-get install&lt;/span&gt; spawn-fcgi fcgiwrap&lt;/code&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;And this is an example of the virtual host which allows normal operation under /var/www as well as aliases for the /nagios/ folder (modify it according to your configuration):&lt;/p&gt;
&lt;div class=&quot;geshifilter&quot;&gt;
&lt;div class=&quot;c geshifilter-c&quot; style=&quot;font-family:monospace;&quot;&gt;server &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
        server_name example.&lt;span style=&quot;color: #202020;&quot;&gt;com&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;        access_log  &lt;span style=&quot;color: #339933;&quot;&gt;/&lt;/span&gt;var&lt;span style=&quot;color: #339933;&quot;&gt;/&lt;/span&gt;&lt;a href=&quot;http://www.opengroup.org/onlinepubs/009695399/functions/log.html&quot;&gt;&lt;span style=&quot;color: #000066;&quot;&gt;log&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #339933;&quot;&gt;/&lt;/span&gt;nginx&lt;span style=&quot;color: #339933;&quot;&gt;/&lt;/span&gt;example.&lt;span style=&quot;color: #202020;&quot;&gt;com&lt;/span&gt;.&lt;span style=&quot;color: #202020;&quot;&gt;access&lt;/span&gt;.&lt;a href=&quot;http://www.opengroup.org/onlinepubs/009695399/functions/log.html&quot;&gt;&lt;span style=&quot;color: #000066;&quot;&gt;log&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
        error_log   &lt;span style=&quot;color: #339933;&quot;&gt;/&lt;/span&gt;var&lt;span style=&quot;color: #339933;&quot;&gt;/&lt;/span&gt;&lt;a href=&quot;http://www.opengroup.org/onlinepubs/009695399/functions/log.html&quot;&gt;&lt;span style=&quot;color: #000066;&quot;&gt;log&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #339933;&quot;&gt;/&lt;/span&gt;nginx&lt;span style=&quot;color: #339933;&quot;&gt;/&lt;/span&gt;example.&lt;span style=&quot;color: #202020;&quot;&gt;com&lt;/span&gt;.&lt;span style=&quot;color: #202020;&quot;&gt;error&lt;/span&gt;.&lt;a href=&quot;http://www.opengroup.org/onlinepubs/009695399/functions/log.html&quot;&gt;&lt;span style=&quot;color: #000066;&quot;&gt;log&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
  &lt;br /&gt;
  auth_basic            &lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;Restricted Nagios Area!&quot;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
  auth_basic_user_file  &lt;span style=&quot;color: #339933;&quot;&gt;/&lt;/span&gt;etc&lt;span style=&quot;color: #339933;&quot;&gt;/&lt;/span&gt;nagios&lt;span style=&quot;color: #339933;&quot;&gt;/&lt;/span&gt;htpasswd.&lt;span style=&quot;color: #202020;&quot;&gt;users&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;     &lt;br /&gt;
    &lt;br /&gt;
        root    &lt;span style=&quot;color: #339933;&quot;&gt;/&lt;/span&gt;var&lt;span style=&quot;color: #339933;&quot;&gt;/&lt;/span&gt;www&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
        index   index.&lt;span style=&quot;color: #202020;&quot;&gt;php&lt;/span&gt; index.&lt;span style=&quot;color: #202020;&quot;&gt;html&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;   location &lt;span style=&quot;color: #339933;&quot;&gt;/&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
    try_files $uri $uri&lt;span style=&quot;color: #339933;&quot;&gt;/&lt;/span&gt; index.&lt;span style=&quot;color: #202020;&quot;&gt;php&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
  &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
  &lt;br /&gt;
  location &lt;span style=&quot;color: #339933;&quot;&gt;/&lt;/span&gt;nagios &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
    alias &lt;span style=&quot;color: #339933;&quot;&gt;/&lt;/span&gt;opt&lt;span style=&quot;color: #339933;&quot;&gt;/&lt;/span&gt;nagios&lt;span style=&quot;color: #339933;&quot;&gt;/&lt;/span&gt;share&lt;span style=&quot;color: #339933;&quot;&gt;/;&lt;/span&gt;&lt;br /&gt;
  &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;  location ~ &lt;span style=&quot;color: #339933;&quot;&gt;^/&lt;/span&gt;nagios&lt;span style=&quot;color: #339933;&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;.&lt;span style=&quot;color: #339933;&quot;&gt;*&lt;/span&gt;\.&lt;span style=&quot;color: #202020;&quot;&gt;php&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;$ &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
    alias &lt;span style=&quot;color: #339933;&quot;&gt;/&lt;/span&gt;opt&lt;span style=&quot;color: #339933;&quot;&gt;/&lt;/span&gt;nagios&lt;span style=&quot;color: #339933;&quot;&gt;/&lt;/span&gt;share&lt;span style=&quot;color: #339933;&quot;&gt;/&lt;/span&gt;$&lt;span style=&quot;color:#800080;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
    include &lt;span style=&quot;color: #339933;&quot;&gt;/&lt;/span&gt;etc&lt;span style=&quot;color: #339933;&quot;&gt;/&lt;/span&gt;nginx&lt;span style=&quot;color: #339933;&quot;&gt;/&lt;/span&gt;fastcgi.&lt;span style=&quot;color: #202020;&quot;&gt;conf&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
    fastcgi_pass unix&lt;span style=&quot;color: #339933;&quot;&gt;:/&lt;/span&gt;var&lt;span style=&quot;color: #339933;&quot;&gt;/&lt;/span&gt;run&lt;span style=&quot;color: #339933;&quot;&gt;/&lt;/span&gt;php5&lt;span style=&quot;color: #339933;&quot;&gt;-&lt;/span&gt;fpm.&lt;span style=&quot;color: #202020;&quot;&gt;sock&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
  &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
  &lt;br /&gt;
  location ~ \.&lt;span style=&quot;color: #202020;&quot;&gt;cgi&lt;/span&gt;$ &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
    root &lt;span style=&quot;color: #339933;&quot;&gt;/&lt;/span&gt;opt&lt;span style=&quot;color: #339933;&quot;&gt;/&lt;/span&gt;nagios&lt;span style=&quot;color: #339933;&quot;&gt;/&lt;/span&gt;sbin&lt;span style=&quot;color: #339933;&quot;&gt;/;&lt;/span&gt;&lt;br /&gt;
    rewrite &lt;span style=&quot;color: #339933;&quot;&gt;^/&lt;/span&gt;nagios&lt;span style=&quot;color: #339933;&quot;&gt;/&lt;/span&gt;cgi&lt;span style=&quot;color: #339933;&quot;&gt;-&lt;/span&gt;bin&lt;span style=&quot;color: #339933;&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;.&lt;span style=&quot;color: #339933;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;\.&lt;span style=&quot;color: #202020;&quot;&gt;cgi&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;/&lt;/span&gt;$&lt;span style=&quot;color:#800080;&quot;&gt;1&lt;/span&gt;.&lt;span style=&quot;color: #202020;&quot;&gt;cgi&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;break&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
    fastcgi_param AUTH_USER $remote_user&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
    fastcgi_param REMOTE_USER $remote_user&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;    &lt;br /&gt;
    include &lt;span style=&quot;color: #339933;&quot;&gt;/&lt;/span&gt;etc&lt;span style=&quot;color: #339933;&quot;&gt;/&lt;/span&gt;nginx&lt;span style=&quot;color: #339933;&quot;&gt;/&lt;/span&gt;fastcgi.&lt;span style=&quot;color: #202020;&quot;&gt;conf&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
    fastcgi_pass unix&lt;span style=&quot;color: #339933;&quot;&gt;:/&lt;/span&gt;var&lt;span style=&quot;color: #339933;&quot;&gt;/&lt;/span&gt;run&lt;span style=&quot;color: #339933;&quot;&gt;/&lt;/span&gt;fcgiwrap.&lt;span style=&quot;color: #202020;&quot;&gt;socket&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
  &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;  &lt;br /&gt;
  &lt;br /&gt;
  location ~ \.&lt;span style=&quot;color: #202020;&quot;&gt;php&lt;/span&gt;$ &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
    include &lt;span style=&quot;color: #339933;&quot;&gt;/&lt;/span&gt;etc&lt;span style=&quot;color: #339933;&quot;&gt;/&lt;/span&gt;nginx&lt;span style=&quot;color: #339933;&quot;&gt;/&lt;/span&gt;fastcgi.&lt;span style=&quot;color: #202020;&quot;&gt;conf&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
    fastcgi_pass unix&lt;span style=&quot;color: #339933;&quot;&gt;:/&lt;/span&gt;var&lt;span style=&quot;color: #339933;&quot;&gt;/&lt;/span&gt;run&lt;span style=&quot;color: #339933;&quot;&gt;/&lt;/span&gt;php5&lt;span style=&quot;color: #339933;&quot;&gt;-&lt;/span&gt;fpm.&lt;span style=&quot;color: #202020;&quot;&gt;sock&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
  &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;You can now restart nginx and fcgiwrap and access your nagios installation by visiting example.com/nagios.&lt;/p&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;field field-name-field-tags field-type-taxonomy-term-reference field-label-inline clearfix&quot;&gt;&lt;h3 class=&quot;field-label&quot;&gt;Tags: &lt;/h3&gt;&lt;ul class=&quot;links inline&quot;&gt;&lt;li class=&quot;taxonomy-term-reference-0&quot;&gt;&lt;a href=&quot;/tags/nagios&quot; typeof=&quot;skos:Concept&quot; property=&quot;rdfs:label skos:prefLabel&quot; datatype=&quot;&quot;&gt;Nagios&lt;/a&gt;&lt;/li&gt;&lt;li class=&quot;taxonomy-term-reference-1&quot;&gt;&lt;a href=&quot;/tags/nginx&quot; typeof=&quot;skos:Concept&quot; property=&quot;rdfs:label skos:prefLabel&quot; datatype=&quot;&quot;&gt;NginX&lt;/a&gt;&lt;/li&gt;&lt;li class=&quot;taxonomy-term-reference-2&quot;&gt;&lt;a href=&quot;/tags/fcgiwrap&quot; typeof=&quot;skos:Concept&quot; property=&quot;rdfs:label skos:prefLabel&quot; datatype=&quot;&quot;&gt;FCGIWrap&lt;/a&gt;&lt;/li&gt;&lt;li class=&quot;taxonomy-term-reference-3&quot;&gt;&lt;a href=&quot;/tags/monitoring&quot; typeof=&quot;skos:Concept&quot; property=&quot;rdfs:label skos:prefLabel&quot; datatype=&quot;&quot;&gt;Monitoring&lt;/a&gt;&lt;/li&gt;&lt;li class=&quot;taxonomy-term-reference-4&quot;&gt;&lt;a href=&quot;/tags/ubuntu&quot; typeof=&quot;skos:Concept&quot; property=&quot;rdfs:label skos:prefLabel&quot; datatype=&quot;&quot;&gt;Ubuntu&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;</description>
 <pubDate>Fri, 07 Jan 2011 18:20:18 +0000</pubDate>
 <dc:creator>Vlad</dc:creator>
 <guid isPermaLink="false">22 at http://vladgh.com</guid>
</item>
<item>
 <title>Install NginX and PHP with PHP-FPM, MySQL and APC</title>
 <link>http://vladgh.com/blog/install-nginx-and-php-php-fpm-mysql-and-apc</link>
 <description>&lt;div class=&quot;field field-name-body field-type-text-with-summary field-label-hidden&quot;&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot; property=&quot;content:encoded&quot;&gt;&lt;p&gt;&lt;strong&gt;***  DISCLAIMER: All content provided here including the scripts is provided without any warranty. You use it at your own risk. I can not be held responsible for any damage that may occur because of it. By using the scripts I provide here you accept this terms.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;*** Please bear in mind that this method is intended for development and testing purposes only. If you care about stability and security you should use the packages provided by your distribution.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;An unattended script that installs everything can be found at &lt;a href=&quot;https://github.com/vladgh/VladGh.com-LEMP&quot;&gt;GitHub&lt;/a&gt;. Check the README file for instructions on how to run the installer.&lt;/p&gt;
&lt;p&gt;If you found this useful and you want to contribute, please consider sending a donation (click the button below).&lt;/p&gt;
&lt;p&gt;In this tutorial I will compile a LEMP stack with the latest NginX (1.3.10) and PHP (5.4.10) with FPM, MySQL and APC (3.1.14) on Ubuntu Quantal(12.10). For the moment, Suhosin 0.9.33 is not working with PHP 5.4.x. Apart for some version numbers for some dependencies, all the steps should be the similar for Ubuntu Lucid, Maverick, Natty and Oneiric.&lt;/p&gt;
&lt;p&gt;I will not explain how to configure NginX here. You can find a lot of resources about that on the &lt;a href=&quot;http://wiki.nginx.org&quot;&gt;nginx wiki&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;In order to compile these programs you will need the following dependencies (most of them should already be installed):&lt;/p&gt;
&lt;div class=&quot;geshifilter&quot;&gt;
&lt;div class=&quot;bash geshifilter-bash&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;sudo&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;apt-get install&lt;/span&gt; htop vim-nox binutils &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;cpp&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;flex&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;gcc&lt;/span&gt; libarchive-zip-perl libc6-dev &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;m4&lt;/span&gt; libpcre3 libpcre3-dev libssl-dev libpopt-dev &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;lynx&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;make&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;perl&lt;/span&gt; perl-modules openssl &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;unzip&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;zip&lt;/span&gt; autoconf2.13 gnu-standards &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;automake&lt;/span&gt; libtool &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;bison&lt;/span&gt; build-essential zlib1g-dev ntp ntpdate autotools-dev &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;g++&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;bc&lt;/span&gt; subversion psmisc re2c&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;And also some libraries for PHP:&lt;/p&gt;
&lt;div class=&quot;geshifilter&quot;&gt;
&lt;div class=&quot;bash geshifilter-bash&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;sudo&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;apt-get install&lt;/span&gt; libmysqlclient-dev mysql-client libcurl4-openssl-dev libgd2-xpm-dev libjpeg-dev libpng3-dev libxpm-dev libfreetype6-dev libt1-dev libmcrypt-dev libxslt1-dev &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;bzip2&lt;/span&gt; libbz2-dev libxml2-dev libevent-dev libltdl-dev libmagickwand-dev libmagickcore-dev imagemagick libreadline-dev libc-client-dev libsnmp-dev snmpd snmp libpq-dev&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Now let&#039;s create a folder in which we can play:&lt;/p&gt;
&lt;div class=&quot;geshifilter&quot;&gt;
&lt;div class=&quot;bash geshifilter-bash&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;mkdir&lt;/span&gt; ~&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;lemp &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;cd&lt;/span&gt; ~&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;lemp&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;and start downloading the sources:&lt;/p&gt;
&lt;div class=&quot;geshifilter&quot;&gt;
&lt;div class=&quot;bash geshifilter-bash&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;wget&lt;/span&gt; http:&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;//&lt;/span&gt;nginx.org&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;download&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;nginx-1.3.10.tar.gz&lt;br /&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;wget&lt;/span&gt; http:&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;//&lt;/span&gt;us.php.net&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;distributions&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;php-5.4.10.tar.gz&lt;br /&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;wget&lt;/span&gt; http:&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;//&lt;/span&gt;pecl.php.net&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;get&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;APC-3.1.14.tgz&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;You can visit each site in order to find faster mirrors. Now decompress them:&lt;/p&gt;
&lt;div class=&quot;geshifilter&quot;&gt;
&lt;div class=&quot;bash geshifilter-bash&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;tar&lt;/span&gt; zxvf nginx-1.3.10.tar.gz&lt;br /&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;tar&lt;/span&gt; xzvf php-5.4.10.tar.gz&lt;br /&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;tar&lt;/span&gt; xzvf APC-3.1.14.tgz&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;And now let&#039;s install them one by one. I like to put everything I compile by myself in one place, the /opt directory. By doing this I know where to find things like configuration files and libraries.&lt;/p&gt;
&lt;div class=&quot;geshifilter&quot;&gt;
&lt;div class=&quot;bash geshifilter-bash&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;cd&lt;/span&gt; nginx-1.3.10&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;.&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;configure \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--prefix&lt;/span&gt;=&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;opt&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;nginx \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--conf-path&lt;/span&gt;=&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;etc&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;nginx&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;nginx.conf \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--pid-path&lt;/span&gt;=&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;var&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;run&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;nginx.pid \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--lock-path&lt;/span&gt;=&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;var&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;lock&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;nginx.lock \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--http-log-path&lt;/span&gt;=&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;var&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;log&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;nginx&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;access.log \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--error-log-path&lt;/span&gt;=&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;var&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;log&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;nginx&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;error.log \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--http-client-body-temp-path&lt;/span&gt;=&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;var&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;lib&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;nginx&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;body \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--http-proxy-temp-path&lt;/span&gt;=&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;var&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;lib&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;nginx&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;proxy \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--http-fastcgi-temp-path&lt;/span&gt;=&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;var&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;lib&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;nginx&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;fastcgi \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--http-uwsgi-temp-path&lt;/span&gt;=&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;var&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;lib&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;nginx&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;uwsgi \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--http-scgi-temp-path&lt;/span&gt;=&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;var&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;lib&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;nginx&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;scgi \&lt;br /&gt;
  --with-http_stub_status_module \&lt;br /&gt;
  --with-http_ssl_module \&lt;br /&gt;
  --with-http_realip_module \&lt;br /&gt;
  --with-http_gzip_static_module \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--user&lt;/span&gt;=www-data \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--group&lt;/span&gt;=www-data \&lt;br /&gt;
  --without-mail_pop3_module \&lt;br /&gt;
  --without-mail_imap_module \&lt;br /&gt;
  --without-mail_smtp_module&lt;br /&gt;
  &lt;br /&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;make&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;sudo&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;make&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;install&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;geshifilter&quot;&gt;
&lt;div class=&quot;bash geshifilter-bash&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;cd&lt;/span&gt; ..&lt;br /&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;sudo&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;wget&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-O&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;etc&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;init.d&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;nginx https:&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;//&lt;/span&gt;github.com&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;vladgh&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;VladGh.com-LEMP&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;raw&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;master&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;init_files&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;nginx&lt;br /&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;sudo&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;chmod&lt;/span&gt; +x &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;etc&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;init.d&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;nginx&lt;br /&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;sudo&lt;/span&gt; update-rc.d &lt;span style=&quot;color: #660033;&quot;&gt;-f&lt;/span&gt; nginx defaults&lt;br /&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;sudo&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;mkdir&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-p&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;var&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;lib&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;nginx&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;{&lt;/span&gt;body,proxy,fastcgi,uwsgi,scgi&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;You sould also create the file /etc/logrotate.d/nginx in order to compress the logs.&lt;/p&gt;
&lt;div class=&quot;geshifilter&quot;&gt;
&lt;div class=&quot;bash geshifilter-bash&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;sudo&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;sh&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-c&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;echo &#039;/var/log/nginx/*.log {&lt;br /&gt;
        weekly&lt;br /&gt;
        missingok&lt;br /&gt;
        rotate 52&lt;br /&gt;
        compress&lt;br /&gt;
        delaycompress&lt;br /&gt;
        notifempty&lt;br /&gt;
        create 640 root adm&lt;br /&gt;
        sharedscripts&lt;br /&gt;
        postrotate&lt;br /&gt;
                [ ! -f /var/run/nginx.pid ] || kill -USR1 \&lt;span style=&quot;color: #780078;&quot;&gt;`cat /var/run/nginx.pid\`&lt;/span&gt;&lt;br /&gt;
        endscript&lt;br /&gt;
}&#039; &amp;gt; /etc/logrotate.d/nginx&quot;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;You can also find a very simple configuration for nginx at &lt;a href=&quot;https://github.com/vladgh/VladGh.com/blob/master/nginx.conf&quot;&gt;https://github.com/vladgh/VladGh.com/blob/master/nginx.conf&lt;/a&gt;, but I strongly recommend to use the &lt;a href=&quot;http://wiki.nginx.org/Configuration&quot;&gt;Nginx Configuration page&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Starting with Ubuntu 11.04 the canonical team modified the path for some libraries so you might need to run the following set of commands in order to get the PHP compilation to work:&lt;/p&gt;
&lt;div class=&quot;geshifilter&quot;&gt;
&lt;div class=&quot;bash geshifilter-bash&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #007800;&quot;&gt;arch&lt;/span&gt;=$&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;(&lt;/span&gt;dpkg-architecture -qDEB_HOST_MULTIARCH&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;[&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-f&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;usr&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;lib&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #800000;&quot;&gt;${arch}&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;libjpeg.so &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;sudo&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;ln&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-s&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;usr&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;lib&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #800000;&quot;&gt;${arch}&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;libjpeg.so &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;usr&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;lib&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;[&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-f&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;usr&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;lib&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #800000;&quot;&gt;${arch}&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;libpng.so &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;sudo&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;ln&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-s&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;usr&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;lib&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #800000;&quot;&gt;${arch}&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;libpng.so &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;usr&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;lib&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;[&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-f&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;usr&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;lib&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #800000;&quot;&gt;${arch}&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;libXpm.so &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;sudo&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;ln&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-s&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;usr&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;lib&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #800000;&quot;&gt;${arch}&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;libXpm.so &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;usr&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;lib&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;[&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-f&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;usr&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;lib&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #800000;&quot;&gt;${arch}&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;libmysqlclient.so &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;sudo&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;ln&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-s&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;usr&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;lib&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #800000;&quot;&gt;${arch}&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;libmysqlclient.so &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;usr&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;lib&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;[&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-d&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;usr&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;lib&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;i386-linux-gnu&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;mit-krb5 &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;sudo&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;ln&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-s&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;usr&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;lib&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #800000;&quot;&gt;${arch}&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;mit-krb5&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;lib&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;*&lt;/span&gt;.so &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;usr&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;lib&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Now let&#039;s compile the PHP packages:&lt;/p&gt;
&lt;div class=&quot;geshifilter&quot;&gt;
&lt;div class=&quot;bash geshifilter-bash&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;sudo&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;mkdir&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;var&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;www&lt;br /&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;sudo&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;chown&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-R&lt;/span&gt; www-data:www-data &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;var&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;www&lt;br /&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;cd&lt;/span&gt; php-5.4.10&lt;/p&gt;
&lt;p&gt;.&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;buildconf &lt;span style=&quot;color: #660033;&quot;&gt;--force&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;.&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;configure \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--prefix&lt;/span&gt;=&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;opt&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;php5 \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--with-config-file-path&lt;/span&gt;=&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;etc&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;php5 \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--with-config-file-scan-dir&lt;/span&gt;=&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;etc&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;php5&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;conf.d \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--with-curl&lt;/span&gt; \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--with-pear&lt;/span&gt; \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--with-gd&lt;/span&gt; \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--with-jpeg-dir&lt;/span&gt; \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--with-png-dir&lt;/span&gt; \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--with-zlib&lt;/span&gt; \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--with-xpm-dir&lt;/span&gt; \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--with-freetype-dir&lt;/span&gt; \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--with-t1lib&lt;/span&gt; \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--with-mcrypt&lt;/span&gt; \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--with-mhash&lt;/span&gt; \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--with-mysql&lt;/span&gt; \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--with-mysqli&lt;/span&gt; \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--with-pgsql&lt;/span&gt; \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--with-pdo-mysql&lt;/span&gt; \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--with-pdo-pgsql&lt;/span&gt; \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--with-openssl&lt;/span&gt; \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--with-xmlrpc&lt;/span&gt; \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--with-xsl&lt;/span&gt; \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--with-bz2&lt;/span&gt; \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--with-gettext&lt;/span&gt; \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--with-readline&lt;/span&gt; \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--with-fpm-user&lt;/span&gt;=www-data \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--with-fpm-group&lt;/span&gt;=www-data \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--with-imap&lt;/span&gt; \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--with-imap-ssl&lt;/span&gt; \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--with-kerberos&lt;/span&gt; \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--with-snmp&lt;/span&gt; \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--disable-debug&lt;/span&gt; \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--enable-fpm&lt;/span&gt; \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--enable-cli&lt;/span&gt; \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--enable-inline-optimization&lt;/span&gt; \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--enable-exif&lt;/span&gt; \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--enable-wddx&lt;/span&gt; \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--enable-zip&lt;/span&gt; \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--enable-bcmath&lt;/span&gt; \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--enable-calendar&lt;/span&gt; \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--enable-ftp&lt;/span&gt; \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--enable-mbstring&lt;/span&gt; \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--enable-soap&lt;/span&gt; \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--enable-sockets&lt;/span&gt; \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--enable-shmop&lt;/span&gt; \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--enable-dba&lt;/span&gt; \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--enable-sysvsem&lt;/span&gt; \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--enable-sysvshm&lt;/span&gt; \&lt;br /&gt;
  &lt;span style=&quot;color: #660033;&quot;&gt;--enable-sysvmsg&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;make&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;sudo&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;make&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;install&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The next step is to configure PHP-FPM:&lt;/p&gt;
&lt;div class=&quot;geshifilter&quot;&gt;
&lt;div class=&quot;bash geshifilter-bash&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;sudo&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;mkdir&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;var&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;log&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;php-fpm&lt;br /&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;sudo&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;mkdir&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-p&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;etc&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;php5&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;conf.d&lt;br /&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;sudo&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;chown&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-R&lt;/span&gt; www-data:www-data &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;var&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;log&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;php-fpm&lt;br /&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;sudo&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;cp&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-f&lt;/span&gt; php.ini-production &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;etc&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;php5&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;php.ini&lt;br /&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;sudo&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;chmod&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;644&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;etc&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;php5&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;php.ini&lt;br /&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;sudo&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;cp&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-f&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;opt&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;php5&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;etc&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;php-fpm.conf.default &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;etc&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;php5&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;php-fpm.conf&lt;br /&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;sudo&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;cp&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-f&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;opt&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;php5&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;etc&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;pear.conf &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;etc&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;php5&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;pear.conf&lt;br /&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;sudo&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;cp&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-f&lt;/span&gt; sapi&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;fpm&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;init.d.php-fpm &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;etc&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;init.d&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;php-fpm&lt;br /&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;sudo&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;chmod&lt;/span&gt; +x &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;etc&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;init.d&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;php-fpm&lt;br /&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;sudo&lt;/span&gt; update-rc.d &lt;span style=&quot;color: #660033;&quot;&gt;-f&lt;/span&gt; php-fpm defaults&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;We should also modify the init file and the configuration file for PHP with the standard path for the pid file (/var/run):&lt;/p&gt;
&lt;div class=&quot;geshifilter&quot;&gt;
&lt;div class=&quot;bash geshifilter-bash&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;sudo&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;sed&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-i&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;.bak&quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;s/php_fpm_CONF=.*/php_fpm_CONF=\/etc\/php5\/php-fpm.conf/&quot;&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;etc&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;init.d&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;php-fpm&lt;br /&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;sudo&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;sed&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-i&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;s/php_fpm_PID=.*/php_fpm_PID=\/var\/run\/php-fpm.pid/&quot;&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;etc&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;init.d&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;php-fpm&lt;br /&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;sudo&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;sed&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-i&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;.bak&quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;s/;pid = .*/pid = \/var\/run\/php-fpm.pid/&quot;&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;etc&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;php5&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;php-fpm.conf&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;You can make the desired modifications to /etc/php5/php-fpm.conf file. This is were you can setup the server to listen on a socket or TCP port, or you can adjust how many processes you want. The file is very well documented in the comments. A sample conf file can be found &lt;a href=&quot;https://github.com/vladgh/VladGh.com/blob/master/php-fpm.conf&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The newer versions of php complain if a time zone is not set on php.ini (so we grab the system&#039;s one)&lt;/p&gt;
&lt;div class=&quot;geshifilter&quot;&gt;
&lt;div class=&quot;bash geshifilter-bash&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #007800;&quot;&gt;TIMEZONE&lt;/span&gt;=$&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;[&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-f&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;etc&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;timezone &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;cat&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;etc&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;timezone &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;sed&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;s/\//\\\\\//g&quot;&lt;/span&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;sudo&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;sed&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-i&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;.bak&quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;s/^\;date\.timezone.*$/date\.timezone = &lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\&quot;&lt;/span&gt;&lt;span style=&quot;color: #007800;&quot;&gt;${TIMEZONE}&lt;/span&gt;&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\&quot;&lt;/span&gt; /g&quot;&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;etc&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;php5&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;php.ini&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Create the logrotate file for PHP with the following command:&lt;/p&gt;
&lt;div class=&quot;geshifilter&quot;&gt;
&lt;div class=&quot;bash geshifilter-bash&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;sudo&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;sh&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-c&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;echo &#039;/var/log/php-fpm/*.log {&lt;br /&gt;
        weekly&lt;br /&gt;
        missingok&lt;br /&gt;
        rotate 52&lt;br /&gt;
        compress&lt;br /&gt;
        delaycompress&lt;br /&gt;
        notifempty&lt;br /&gt;
        create 640 www-data www-data&lt;br /&gt;
        sharedscripts&lt;br /&gt;
        postrotate&lt;br /&gt;
                [ ! -f /var/run/php-fpm.pid ] || kill -USR1 \&lt;span style=&quot;color: #780078;&quot;&gt;`cat /var/run/php-fpm.pid\`&lt;/span&gt;&lt;br /&gt;
        endscript&lt;br /&gt;
}&#039; &amp;gt; /etc/logrotate.d/php-fpm&quot;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Because the executables for both PHP and NginX are not in a standard location you can add the following lines to /etc/environment so that the new path is always loaded:&lt;/p&gt;
&lt;div class=&quot;geshifilter&quot;&gt;
&lt;div class=&quot;bash geshifilter-bash&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;export&lt;/span&gt; &lt;span style=&quot;color: #007800;&quot;&gt;PATH&lt;/span&gt;=&lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;/opt/php5/bin:/opt/php5/sbin:/opt/nginx/sbin:&lt;span style=&quot;color: #007800;&quot;&gt;$PATH&lt;/span&gt;&quot;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;sudo&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;sh&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-c&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;echo &lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\&quot;&lt;/span&gt;PATH=&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\&quot;&lt;/span&gt;&lt;span style=&quot;color: #007800;&quot;&gt;$PATH&lt;/span&gt;&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\&quot;&lt;/span&gt;&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\&quot;&lt;/span&gt; &amp;gt; /etc/environment&quot;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Now you should be able to see the version numbers for NginX and PHP:&lt;/p&gt;
&lt;div class=&quot;geshifilter&quot;&gt;
&lt;div class=&quot;bash geshifilter-bash&quot; style=&quot;font-family:monospace;&quot;&gt;nginx &lt;span style=&quot;color: #660033;&quot;&gt;-V&lt;/span&gt;&lt;br /&gt;
php &lt;span style=&quot;color: #660033;&quot;&gt;-v&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;And also the location of the executables:&lt;/p&gt;
&lt;div class=&quot;geshifilter&quot;&gt;
&lt;div class=&quot;bash geshifilter-bash&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;which&lt;/span&gt; nginx&lt;br /&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;which&lt;/span&gt; php&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Now let&#039;s install the latest APC:&lt;/p&gt;
&lt;div class=&quot;geshifilter&quot;&gt;
&lt;div class=&quot;bash geshifilter-bash&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;cd&lt;/span&gt; ..&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;APC-3.1.14&lt;br /&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;opt&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;php5&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;bin&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;phpize &lt;span style=&quot;color: #660033;&quot;&gt;-clean&lt;/span&gt;&lt;br /&gt;
.&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;configure &lt;span style=&quot;color: #660033;&quot;&gt;--enable-apc&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;--with-php-config&lt;/span&gt;=&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;opt&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;php5&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;bin&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;php-config &lt;span style=&quot;color: #660033;&quot;&gt;--with-libdir&lt;/span&gt;=&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;opt&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;php5&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;lib&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;php &lt;br /&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;make&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;sudo&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;make&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;install&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;You will have to add the extension in php.ini:&lt;/p&gt;
&lt;div class=&quot;geshifilter&quot;&gt;
&lt;div class=&quot;bash geshifilter-bash&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;sudo&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;sh&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-c&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;echo &#039;extension = apc.so&lt;br /&gt;
apc.enabled = 1&lt;br /&gt;
apc.shm_size = 128M&lt;br /&gt;
apc.shm_segments=1&lt;br /&gt;
apc.write_lock = 1&lt;br /&gt;
apc.rfc1867 = On&lt;br /&gt;
apc.ttl=7200&lt;br /&gt;
apc.user_ttl=7200&lt;br /&gt;
apc.num_files_hint=1024&lt;br /&gt;
apc.mmap_file_mask=/tmp/apc.XXXXXX&lt;br /&gt;
apc.enable_cli=1&lt;br /&gt;
; Optional, for &lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\&quot;&lt;/span&gt;[apc-warning] Potential cache slam averted for key... errors&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\&quot;&lt;/span&gt;&lt;br /&gt;
; apc.slam_defense = Off&#039; &amp;gt; /etc/php5/conf.d/apc.ini&quot;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;This is it! You can now start the servers:&lt;/p&gt;
&lt;div class=&quot;geshifilter&quot;&gt;
&lt;div class=&quot;bash geshifilter-bash&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;sudo&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;etc&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;init.d&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;php-fpm start&lt;br /&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;sudo&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;etc&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;init.d&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;nginx start&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;If you want a MySQL server installed you can run the following command.&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;geshifilter&quot;&gt;&lt;code class=&quot;bash geshifilter-bash&quot;&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;apt-get install&lt;/span&gt; mysql-server mysql-client&lt;/code&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;This should be enough to get MySQL up and running. If you have a separate database somewhere you can only install the mysql-client package. For additional config parameters look into the &lt;strong&gt;/usr/share/doc/mysql-server-5.1/examples&lt;/strong&gt; folder and you will find a few configurations. You can also get the MySQLTuner.pl script which will give a lot more information on how to fine tune your mysql server:&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;geshifilter&quot;&gt;&lt;code class=&quot;bash geshifilter-bash&quot;&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;wget&lt;/span&gt; mysqltuner.pl&lt;/code&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;You should now have a  fully functional LEMP platform.&lt;/p&gt;
&lt;p&gt;An unattended script that installs everything can be found at &lt;a href=&quot;https://github.com/vladgh/VladGh.com-LEMP&quot;&gt;GitHub&lt;/a&gt;. Check the README file for instructions on how to run the installer.&lt;/p&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;field field-name-field-tags field-type-taxonomy-term-reference field-label-inline clearfix&quot;&gt;&lt;h3 class=&quot;field-label&quot;&gt;Tags: &lt;/h3&gt;&lt;ul class=&quot;links inline&quot;&gt;&lt;li class=&quot;taxonomy-term-reference-0&quot;&gt;&lt;a href=&quot;/tags/nginx&quot; typeof=&quot;skos:Concept&quot; property=&quot;rdfs:label skos:prefLabel&quot; datatype=&quot;&quot;&gt;NginX&lt;/a&gt;&lt;/li&gt;&lt;li class=&quot;taxonomy-term-reference-1&quot;&gt;&lt;a href=&quot;/tags/php-fpm&quot; typeof=&quot;skos:Concept&quot; property=&quot;rdfs:label skos:prefLabel&quot; datatype=&quot;&quot;&gt;PHP-FPM&lt;/a&gt;&lt;/li&gt;&lt;li class=&quot;taxonomy-term-reference-2&quot;&gt;&lt;a href=&quot;/tags/mysql&quot; typeof=&quot;skos:Concept&quot; property=&quot;rdfs:label skos:prefLabel&quot; datatype=&quot;&quot;&gt;MySQL&lt;/a&gt;&lt;/li&gt;&lt;li class=&quot;taxonomy-term-reference-3&quot;&gt;&lt;a href=&quot;/tags/suhosin&quot; typeof=&quot;skos:Concept&quot; property=&quot;rdfs:label skos:prefLabel&quot; datatype=&quot;&quot;&gt;Suhosin&lt;/a&gt;&lt;/li&gt;&lt;li class=&quot;taxonomy-term-reference-4&quot;&gt;&lt;a href=&quot;/tags/apc&quot; typeof=&quot;skos:Concept&quot; property=&quot;rdfs:label skos:prefLabel&quot; datatype=&quot;&quot;&gt;APC&lt;/a&gt;&lt;/li&gt;&lt;li class=&quot;taxonomy-term-reference-5&quot;&gt;&lt;a href=&quot;/tags/imagick&quot; typeof=&quot;skos:Concept&quot; property=&quot;rdfs:label skos:prefLabel&quot; datatype=&quot;&quot;&gt;Imagick&lt;/a&gt;&lt;/li&gt;&lt;li class=&quot;taxonomy-term-reference-6&quot;&gt;&lt;a href=&quot;/tags/ubuntu&quot; typeof=&quot;skos:Concept&quot; property=&quot;rdfs:label skos:prefLabel&quot; datatype=&quot;&quot;&gt;Ubuntu&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;</description>
 <pubDate>Sat, 24 Jul 2010 14:52:30 +0000</pubDate>
 <dc:creator>Vlad</dc:creator>
 <guid isPermaLink="false">18 at http://vladgh.com</guid>
</item>
<item>
 <title>Jetty Powered MultiCore Apache Solr</title>
 <link>http://vladgh.com/blog/jetty-powered-multicore-apache-solr</link>
 <description>&lt;div class=&quot;field field-name-body field-type-text-with-summary field-label-hidden&quot;&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot; property=&quot;content:encoded&quot;&gt;&lt;p&gt;Installing the latest version of Apache Solr search engine on a Jetty powered server is very straightforward. You simply copy the packages in the right place, change a few lines to customize it and you are done. This tutorial is meant for Ubuntu users but it can be easily adapted for other distributions.&lt;/p&gt;
&lt;p&gt;Assuming you are root (you can become by running &quot;sudo -i&quot; command), the first thing you need to do is get the dependencies:&lt;/p&gt;
&lt;div class=&quot;geshifilter&quot;&gt;
&lt;div class=&quot;bash geshifilter-bash&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;apt-get update&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;apt-get upgrade&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;apt-get install&lt;/span&gt; openjdk-&lt;span style=&quot;color: #000000;&quot;&gt;6&lt;/span&gt;-jdk&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;I recommend the java development kit from Ubuntu but if you want you can also use the one made by Sun (replace &quot;natty&quot; with your own distribution codename):&lt;/p&gt;
&lt;div class=&quot;geshifilter&quot;&gt;
&lt;div class=&quot;bash geshifilter-bash&quot; style=&quot;font-family:monospace;&quot;&gt;add-apt-repository &lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;deb &lt;a href=&quot;http://archive.canonical.com/&quot;&gt;http://archive.canonical.com/&lt;/a&gt; natty partner&quot;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;apt-get install&lt;/span&gt; sun-java6-jdk&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Download and extract the Jetty server into the /opt folder (Visit &lt;a href=&quot;http://download.eclipse.org/jetty/&quot;&gt;http://download.eclipse.org/jetty/&lt;/a&gt; for the latest version):&lt;/p&gt;
&lt;div class=&quot;geshifilter&quot;&gt;
&lt;div class=&quot;bash geshifilter-bash&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #007800;&quot;&gt;JETTY_VERSION&lt;/span&gt;=7.4.5.v20110725&lt;br /&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;cd&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;opt&lt;br /&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;wget&lt;/span&gt; http:&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;//&lt;/span&gt;download.eclipse.org&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;jetty&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #007800;&quot;&gt;$JETTY_VERSION&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;dist&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;jetty-distribution-&lt;span style=&quot;color: #007800;&quot;&gt;$JETTY_VERSION&lt;/span&gt;.tar.gz&lt;br /&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;tar&lt;/span&gt; xfz jetty-distribution-&lt;span style=&quot;color: #007800;&quot;&gt;$JETTY_VERSION&lt;/span&gt;.tar.gz&lt;br /&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;mv&lt;/span&gt; jetty-distribution-&lt;span style=&quot;color: #007800;&quot;&gt;$JETTY_VERSION&lt;/span&gt; jetty&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Download and extract the Apache Solr application into a temporary folder. We don&#039;t need the embedded jetty because we have our own. The URL provided is just a mirror so it&#039;s best to visit &lt;a href=&quot;http://lucene.apache.org/solr/&quot;&gt;http://lucene.apache.org/solr/&lt;/a&gt; for the latest version and a faster download link:&lt;/p&gt;
&lt;div class=&quot;geshifilter&quot;&gt;
&lt;div class=&quot;bash geshifilter-bash&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #007800;&quot;&gt;SOLR_VERSION&lt;/span&gt;=3.3.0&lt;br /&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;cd&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;tmp&lt;br /&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;wget&lt;/span&gt; http:&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;//&lt;/span&gt;mirrors.kahuki.com&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;apache&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;//&lt;/span&gt;lucene&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;solr&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #007800;&quot;&gt;$SOLR_VERSION&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;apache-solr-&lt;span style=&quot;color: #007800;&quot;&gt;$SOLR_VERSION&lt;/span&gt;.tgz&lt;br /&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;tar&lt;/span&gt; zxvf apache-solr-&lt;span style=&quot;color: #007800;&quot;&gt;$SOLR_VERSION&lt;/span&gt;.tgz&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Next, we need to copy the actual Solr application into Jetty:&lt;/p&gt;
&lt;div class=&quot;geshifilter&quot;&gt;
&lt;div class=&quot;bash geshifilter-bash&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;cp&lt;/span&gt; apache-solr-&lt;span style=&quot;color: #007800;&quot;&gt;$SOLR_VERSION&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;dist&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;apache-solr-&lt;span style=&quot;color: #007800;&quot;&gt;$SOLR_VERSION&lt;/span&gt;.war &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;opt&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;jetty&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;webapps&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;solr.war&lt;br /&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;cp&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-R&lt;/span&gt; apache-solr-&lt;span style=&quot;color: #007800;&quot;&gt;$SOLR_VERSION&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;example&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;solr &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;opt&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Before we start the server we need to add a few options to java:&lt;/p&gt;
&lt;div class=&quot;geshifilter&quot;&gt;
&lt;div class=&quot;bash geshifilter-bash&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;JETTY_USER=jetty&lt;br /&gt;
JAVA_OPTIONS=&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\&quot;&lt;/span&gt;-Dsolr.solr.home=/opt/solr&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\&quot;&lt;/span&gt;&quot;&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;etc&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;default&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;jetty&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;By modifying the java_options line you can customize/optimize even more or Java environment, but that&#039;s outside the scope of this tutorial. For example:&lt;/p&gt;
&lt;div class=&quot;geshifilter&quot;&gt;
&lt;div class=&quot;bash geshifilter-bash&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #007800;&quot;&gt;JAVA_OPTIONS&lt;/span&gt;=&lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;-Xms16m -Xmx64m -Djava.awt.headless=true -Dsolr.solr.home=/opt/solr&quot;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;We also need to create the multicore config for Solr:&lt;/p&gt;
&lt;div class=&quot;geshifilter&quot;&gt;
&lt;div class=&quot;bash geshifilter-bash&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;mkdir&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-p&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;opt&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;solr&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;example1.com&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;data&lt;br /&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;mkdir&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-p&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;opt&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;solr&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;example2.com&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;data&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;cp&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-R&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;opt&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;solr&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;conf &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;opt&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;solr&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;example1.com&lt;br /&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;cp&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-R&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;opt&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;solr&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;conf &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;opt&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;solr&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;example2.com&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;And modify /opt/solr/solr.xml accordingly:&lt;/p&gt;
&lt;div class=&quot;geshifilter&quot;&gt;
&lt;div class=&quot;xml geshifilter-xml&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;lt;cores&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;adminPath&lt;/span&gt;=&lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;/admin/cores&quot;&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;defaultCoreName&lt;/span&gt;=&lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;collection1&quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
  &lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;lt;core&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;name&lt;/span&gt;=&lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;Example1&quot;&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;instanceDir&lt;/span&gt;=&lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;example1.com&quot;&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
  &lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;lt;core&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;name&lt;/span&gt;=&lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;Example1&quot;&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;instanceDir&lt;/span&gt;=&lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;example1.com&quot;&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;lt;/cores&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;One last thing is to create the user under which all this will run, set the right permissions and check if everything is in order with Jetty:&lt;/p&gt;
&lt;div class=&quot;geshifilter&quot;&gt;
&lt;div class=&quot;bash geshifilter-bash&quot; style=&quot;font-family:monospace;&quot;&gt;adduser &lt;span style=&quot;color: #660033;&quot;&gt;--system&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;--no-create-home&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;--disabled-login&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;--disabled-password&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;--group&lt;/span&gt; jetty&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;chown&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-R&lt;/span&gt; jetty:jetty &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;opt&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;jetty&lt;br /&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;chown&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-R&lt;/span&gt; jetty:jetty &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;opt&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;solr&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;opt&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;jetty&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;bin&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;jetty.sh check&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;If everything is in order you can start Jetty and even configure it to run at bootup:&lt;/p&gt;
&lt;div class=&quot;geshifilter&quot;&gt;
&lt;div class=&quot;bash geshifilter-bash&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;opt&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;jetty&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;bin&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;jetty.sh start&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;ln&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-s&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;opt&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;jetty&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;bin&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;jetty.sh &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;etc &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;init.d&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;jetty&lt;br /&gt;
update-rc.d &lt;span style=&quot;color: #660033;&quot;&gt;-f&lt;/span&gt; jetty defaults&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;That&#039;s it; you now have the latest Apache Solr engine on the latest Jetty web server.&lt;/p&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;field field-name-field-tags field-type-taxonomy-term-reference field-label-inline clearfix&quot;&gt;&lt;h3 class=&quot;field-label&quot;&gt;Tags: &lt;/h3&gt;&lt;ul class=&quot;links inline&quot;&gt;&lt;li class=&quot;taxonomy-term-reference-0&quot;&gt;&lt;a href=&quot;/tags/apache-solr&quot; typeof=&quot;skos:Concept&quot; property=&quot;rdfs:label skos:prefLabel&quot; datatype=&quot;&quot;&gt;Apache Solr&lt;/a&gt;&lt;/li&gt;&lt;li class=&quot;taxonomy-term-reference-1&quot;&gt;&lt;a href=&quot;/tags/jetty&quot; typeof=&quot;skos:Concept&quot; property=&quot;rdfs:label skos:prefLabel&quot; datatype=&quot;&quot;&gt;Jetty&lt;/a&gt;&lt;/li&gt;&lt;li class=&quot;taxonomy-term-reference-2&quot;&gt;&lt;a href=&quot;/tags/ubuntu&quot; typeof=&quot;skos:Concept&quot; property=&quot;rdfs:label skos:prefLabel&quot; datatype=&quot;&quot;&gt;Ubuntu&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;</description>
 <pubDate>Tue, 29 Jun 2010 20:17:59 +0000</pubDate>
 <dc:creator>Vlad</dc:creator>
 <guid isPermaLink="false">17 at http://vladgh.com</guid>
</item>
</channel>
</rss>
