<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Apache on Evan Hoffman</title><link>https://evan.wtf/tags/apache/</link><description>Recent content in Apache on Evan Hoffman</description><generator>Hugo</generator><language>en-US</language><copyright>Evan Hoffman</copyright><lastBuildDate>Fri, 28 Mar 2014 15:17:30 +0000</lastBuildDate><atom:link href="https://evan.wtf/tags/apache/index.xml" rel="self" type="application/rss+xml"/><item><title>Rails app redirects to wrong port?</title><link>https://evan.wtf/2014/03/28/rails-app-redirects-to-wrong-port/</link><pubDate>Fri, 28 Mar 2014 15:17:30 +0000</pubDate><guid>https://evan.wtf/2014/03/28/rails-app-redirects-to-wrong-port/</guid><description>&lt;p&gt;Ran into a situation in which a rails application was redirecting to /login to force a user to log in, but the Location header said &amp;ldquo;&lt;a href="http://site.com:8085/login%22"&gt;http://site.com:8085/login"&lt;/a&gt;, because nginx was listening on port 8085 on that server. At first I looked to see if there was something in the application code that was doing this, or maybe some setting I could change to fix it, but came up blank. After some Googling I found the answer right &lt;a href="http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_redirect"&gt;in the Nginx docs&lt;/a&gt; (below is my slightly-modified solution that handles https urls as well):&lt;/p&gt;</description></item><item><title>Digital Ocean - First Impressions</title><link>https://evan.wtf/2013/07/24/digital-ocean-first-impressions/</link><pubDate>Wed, 24 Jul 2013 08:59:06 +0000</pubDate><guid>https://evan.wtf/2013/07/24/digital-ocean-first-impressions/</guid><description>&lt;p&gt;For the past few years I&amp;rsquo;ve been hosting this site on an old desktop in my basement on my FiOS connection. This was one of the things I really liked when I switched from Cablevision to Verizon - they don&amp;rsquo;t block port 80 inbound, so I didn&amp;rsquo;t have to pay for separate hosting. My &amp;ldquo;server&amp;rdquo; was an old AMD desktop with 1 gig ram and a sata drive. It was ok; my site was slow but I was ok with that. I configured Nginx to cache the static assets which sped most things up to &amp;ldquo;ok&amp;rdquo; levels but it was never fast.&lt;/p&gt;</description></item><item><title>Using Nginx as a caching proxy in front of Wordpress</title><link>https://evan.wtf/2012/03/07/using-nginx-as-a-caching-proxy-in-front-of-wordpress/</link><pubDate>Wed, 07 Mar 2012 16:43:28 +0000</pubDate><guid>https://evan.wtf/2012/03/07/using-nginx-as-a-caching-proxy-in-front-of-wordpress/</guid><description>Why you may want to use Nginx as a caching reverse-proxy in front of Apache for Wordpress, and config examples for doing so.</description></item><item><title>Making sure SSLv2 is disabled in Apache (and Nginx)</title><link>https://evan.wtf/2011/09/20/making-sure-sslv2-is-disabled-in-apache/</link><pubDate>Tue, 20 Sep 2011 14:06:38 +0000</pubDate><guid>https://evan.wtf/2011/09/20/making-sure-sslv2-is-disabled-in-apache/</guid><description>&lt;p&gt;&lt;strong&gt;Edit Jan 24, 2012:&lt;/strong&gt; Deleted all the crap from this story and just left the recommended Apache and Nginx SSL cipher suites for maximum security without SSLv2 and without BEAST vulnerability (at least according to Qualys).&#10;&lt;strong&gt;Apache httpd&lt;/strong&gt;&lt;/p&gt;&#10;&lt;pre tabindex="0"&gt;&lt;code&gt;SSLProtocol -ALL +SSLv3 +TLSv1&#10;SSLCipherSuite ECDHE-RSA-AES256-SHA384:AES256-SHA256:RC4:HIGH:!MD5:!aNULL:!EDH:!AESGCM;&#10;SSLHonorCipherOrder on&#10;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;strong&gt;nginx&lt;/strong&gt;&lt;/p&gt;&#10;&lt;pre tabindex="0"&gt;&lt;code&gt;ssl_protocols SSLv3 TLSv1;&#10; ssl_ciphers ECDHE-RSA-AES256-SHA384:AES256-SHA256:RC4:HIGH:!MD5:!aNULL:!EDH:!AESGCM;&#10; ssl_prefer_server_ciphers on;&#10;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Source:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;a href="https://community.qualys.com/blogs/securitylabs/2011/10/17/mitigating-the-beast-attack-on-tls"&gt;Qualys&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://www.ssllabs.com/ssldb/"&gt;SSL checker&lt;/a&gt;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;&lt;a href="http://affiliate.godaddy.com/redirect/5F43C3ECBA841ACFC3859F4F4E6CA7DA64C271385B2D61A3AD6F3CCE83EB1DD8235E60DCD7D63BCD92E2429E79A75FAC"&gt;&lt;img src="http://affiliate.godaddy.com/ads/5F43C3ECBA841ACFC3859F4F4E6CA7DA64C271385B2D61A3AD6F3CCE83EB1DD8235E60DCD7D63BCD92E2429E79A75FAC" alt="Go Daddy $12.99 SSL Sale!"&gt;&lt;/a&gt;&lt;/p&gt;</description></item><item><title>Logging RT username in Apache access_log</title><link>https://evan.wtf/2011/08/08/logging-rt-username-in-apache-access_log/</link><pubDate>Mon, 08 Aug 2011 17:34:18 +0000</pubDate><guid>https://evan.wtf/2011/08/08/logging-rt-username-in-apache-access_log/</guid><description>&lt;p&gt;&lt;a href="http://bestpractical.com/rt/"&gt;RT&lt;/a&gt; has its own internal accounting &amp;amp; tracking system for logging activity, but I was interested in even more granular stuff, like seeing who looked at which tickets. I figured it wouldn&amp;rsquo;t be that hard to log this in Apache. Well, I was kind of right, in that it wasn&amp;rsquo;t &amp;ldquo;hard,&amp;rdquo; but it took me a long time to find the right place to do it. I did finally get it though.&lt;/p&gt;</description></item><item><title>Putting up a "down for maintenance" message using mod_rewrite</title><link>https://evan.wtf/2010/10/08/putting-up-a-down-for-maintenance-message-using-mod_rewrite-2/</link><pubDate>Fri, 08 Oct 2010 18:11:42 +0000</pubDate><guid>https://evan.wtf/2010/10/08/putting-up-a-down-for-maintenance-message-using-mod_rewrite-2/</guid><description>&lt;p&gt;Putting this here for safekeeping so my future self can find it. Mod_rewrite is one of my favorite tools, but it&amp;rsquo;s easy to spend 30 minutes crafting a 2-line directive that actually does what you want. I put this in a .htaccess file in the DocumentRoot of the server, put a &amp;ldquo;We&amp;rsquo;re down&amp;rdquo; message in maintenance.html (or whatever), and all requests will get a 302 redirect to /maintenance.html, except requests for /maintenance.html (for obvious reasons). It appends the original request in case you want to do something with it but that&amp;rsquo;s not really important. It also doesn&amp;rsquo;t do the redirect for images/js/css so those can actually be used in the maintenance message.&lt;/p&gt;</description></item><item><title>Putting up a "down for maintenance" message using mod_rewrite</title><link>https://evan.wtf/2010/10/08/putting-up-a-down-for-maintenance-message-using-mod_rewrite/</link><pubDate>Fri, 08 Oct 2010 18:11:42 +0000</pubDate><guid>https://evan.wtf/2010/10/08/putting-up-a-down-for-maintenance-message-using-mod_rewrite/</guid><description>&lt;p&gt;Putting this here for safekeeping so my future self can find it. Mod_rewrite is one of my favorite tools, but it&amp;rsquo;s easy to spend 30 minutes crafting a 2-line directive that actually does what you want. I put this in a .htaccess file in the DocumentRoot of the server, put a &amp;ldquo;We&amp;rsquo;re down&amp;rdquo; message in maintenance.html (or whatever), and all requests will get a 302 redirect to /maintenance.html, except requests for /maintenance.html (for obvious reasons). It appends the original request in case you want to do something with it but that&amp;rsquo;s not really important. It also doesn&amp;rsquo;t do the redirect for images/js/css so those can actually be used in the maintenance message.&lt;/p&gt;</description></item><item><title>Forcing Wordpress administration over SSL</title><link>https://evan.wtf/2010/09/20/forcing-wordpress-administration-over-ssl/</link><pubDate>Mon, 20 Sep 2010 15:46:05 +0000</pubDate><guid>https://evan.wtf/2010/09/20/forcing-wordpress-administration-over-ssl/</guid><description>&lt;p&gt;I never like typing a password into a non-SSL site, no matter how trivial it is. In order to give my own site this ability I simply used mod_rewrite to force requests to Wordpress&amp;rsquo;s admin pages to go over SSL.&lt;/p&gt;&#10;&lt;p&gt;The .htaccess file for the site looks like this:&lt;/p&gt;&#10;&lt;h1 id="begin-wordpress"&gt;BEGIN WordPress&lt;a class="heading-anchor" href="#begin-wordpress" aria-label="Link to this section"&gt;&#10; &lt;svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2"&#10; stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"&gt;&#10; &lt;path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/&gt;&#10; &lt;path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/&gt;&#10; &lt;/svg&gt;&#10; &lt;/a&gt;&#10;&lt;/h1&gt;&#10;&lt;p&gt;RewriteEngine On&#10;RewriteBase /evan/&#10;RewriteRule ^index.php$ - [L]&#10;RewriteCond %{REQUEST_FILENAME} !-f&#10;RewriteCond %{REQUEST_FILENAME} !-d&#10;RewriteRule . /evan/index.php [L]&lt;/p&gt;</description></item><item><title>Blocking comment spammers by IP</title><link>https://evan.wtf/2010/08/13/blocking-comment-spammers-by-ip/</link><pubDate>Fri, 13 Aug 2010 11:59:27 +0000</pubDate><guid>https://evan.wtf/2010/08/13/blocking-comment-spammers-by-ip/</guid><description>&lt;p&gt;I use &lt;a href="http://akismet.com/"&gt;Akismet&lt;/a&gt; to block comment spam, but it still annoys me that it even exists. Last night I put a simple IP ban into my httpd config. But who to block?&lt;/p&gt;&#10;&lt;p&gt;I used a grep &amp;amp; Perl to get a rough guess of which IPs were submitting the most comments (working on the assumption that one IP address submits many spam comments) It took me about 20 minutes to write this mess but it does what I wanted to do:&#10;&lt;code&gt;[root@lunix ~]# zgrep POST /var/log/httpd/evanhoffman-access_log-201008??.gz | grep comment | perl -ne 'chomp; $_ =~ m/(?:\d{1,3}\.){3}\d{1,3}/; print &amp;quot;$&amp;amp;\n&amp;quot;;' | perl -e '%a = (); while (&amp;lt;&amp;gt;) { chomp; $a{$_} += 1; } while (my ($key, $value) = each (%a)) { if ($value &amp;gt; 1) { print &amp;quot;$value\t=&amp;gt;\t$key\n&amp;quot;;}}' 2 =&amp;gt; 218.6.9.140 180 =&amp;gt; 91.201.66.34 2 =&amp;gt; 213.5.67.41 2 =&amp;gt; 188.187.102.74 [root@lunix ~]#&lt;/code&gt;&lt;/p&gt;</description></item><item><title>LDAP-Active Directory authentication, Part 3</title><link>https://evan.wtf/2010/01/08/ldap-active-directory-authentication-part-3/</link><pubDate>Fri, 08 Jan 2010 19:12:34 +0000</pubDate><guid>https://evan.wtf/2010/01/08/ldap-active-directory-authentication-part-3/</guid><description>&lt;p&gt;So I got everything working with .htaccess and AD/LDAP authentication. Just add LDAPVerifyServerCert Off to the httpd config to let Apache authenticate against an AD server with a self-signed certificate (without dealing with the annoyance of putting the cert on each Apache server).&lt;/p&gt;&#10;&lt;p&gt;With that piece of the puzzle largely solved, I moved on to another: how will users change their passwords (which are all stored in Active Directory)? For users running Windows this is pretty trivial &amp;ndash; they can do it right in Windows when they&amp;rsquo;re logged into the domain. But what about Linux users? I figured the easiest thing to do would be to make a web form to do this. The user would login (with the http/LDAP auth I previously setup) and the form would ask for their password (twice) and update it in Active Directory. Sounds pretty simple to me. I think if this were OpenLDAP it probably would be, but being AD, it&amp;rsquo;s not.&lt;/p&gt;</description></item><item><title>Monitoring SSL certificate expiration with ssl-cert-check</title><link>https://evan.wtf/2009/08/31/monitoring-ssl-certificate-expiration-with-ssl-cert-check/</link><pubDate>Mon, 31 Aug 2009 15:29:11 +0000</pubDate><guid>https://evan.wtf/2009/08/31/monitoring-ssl-certificate-expiration-with-ssl-cert-check/</guid><description>&lt;p&gt;I was about to write a script using OpenSSL to monitor the SSL certificate expiration dates for a few servers when it dawned on me that someone had probably done this already.&lt;/p&gt;&#10;&lt;p&gt;The &lt;a href="http://prefetch.net/articles/checkcertificate.html"&gt;ssl-cert-check&lt;/a&gt; shell script takes a list of hosts/ports and prints out the expiration date (and how many days away that date is). It can also be configured to email a message for any certificates expiring in less than N days for easy cronibility (?). Seems lovely!&lt;/p&gt;</description></item></channel></rss>