<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title>Nginx articles</title>
  <link type="application/atom+xml" href="http://nginx.groups.wuyasea.com/b1ogs/6/articles?format=xml" rel="self"/>
  <link type="text/html" href="http://nginx.groups.wuyasea.com/b1ogs/6/articles" rel="alternate"/>
  <language>en-us</language>
  <entry>
    <title>Simple spam control</title>
    <link type="text/html" href="/articles/simple-spam-control/15" rel="alternate"/>
    <updated>Thu, 31 Jul 2008 10:53:49 -0000</updated>
    <author>
      <name>dorren</name>
    </author>
    <content type="html">If you manage a website that allows anonymous posting, spam will always find you, soon or later. What's the easiest way to filter spams without doing chunk of work? &lt;br /&gt;
&lt;h3&gt;Deny by IP&lt;/h3&gt;
&lt;code&gt;location / {
    deny    124.XXX.XXX.XXX/24;
    deny     58.XXX.XXX.XXX/24;
}
&lt;/code&gt;&lt;br /&gt;
after I added that and reloaded the nginx, spam stopped. &lt;br /&gt;
&lt;br /&gt;
Prior to this, I added captcha check for posting, but that didn't stop the spam at all. Because spam originates from Bangkok, thailand, I wonder if they hired those low cost laborer to send out spam manually, or at least semi-automatically. With ip deny trick, at least it works for now.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Reference&lt;/h3&gt;
&lt;a href="http://wiki.codemongers.com/NginxHttpAccessModule"&gt;http://wiki.codemongers.com/NginxHttpAccessModule&lt;/a&gt;</content>
  </entry>
  <entry>
    <title>How to setup godaddy SSL certificate on Nginx</title>
    <link type="text/html" href="/articles/how-to-setup-godaddy-ssl-certificate-on-nginx/2" rel="alternate"/>
    <updated>Tue, 15 Sep 2009 04:14:20 -0000</updated>
    <author>
      <name>dorren</name>
    </author>
    <content type="html">&lt;h3&gt;1. Generate SSL request&lt;/h3&gt;
First create key, replace "mysite.com" with your site domain name.&lt;br /&gt;
&lt;code class="console"&gt;openssl genrsa  -out www.mysite.com.key 2048&lt;/code&gt;&lt;br /&gt;
then the request,&lt;br /&gt;
&lt;code class="console"&gt;openssl req -new -key www.mysite.com.key -out www.mysite.com.csr&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
that command will prompt a few questions, like below&lt;br /&gt;
&lt;code&gt;
Country Name (2 letter code) [AU]:US
State or Province Name (full name) [Some-State]:New York
Locality Name (eg, city) []:Your town
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Your Corporation
Organizational Unit Name (eg, section) []:IT
&lt;b&gt;Common Name (eg, YOUR name) []:www.mysite.com&lt;/b&gt;
Email Address []:someone@mysite.com
&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
the Common Name is the most important field, that should be the exact domain name for which you are requesting SSL, in most cases, it should be "www.mysite.com". If you are buying for a subdomain, then it should be something like "secured.mysite.com". If for wildcard, it should be "*.mysite.com".&lt;br /&gt;
&lt;br /&gt;
After you finish, you should have 2 files now, www.mysite.com.key and www.mysite.com.csr. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;2. Buy the SSL on Godaddy&lt;/h3&gt;
Now goto godaddy's site, and buy the ssl. If it's for a new website, I highly recommend to buy just one year version first. Their cheapest one is just $19.99/year. The reason is you never know if the new site is going to work out or not, or you may need to create secured subdomains a few months later. Because of all these uncertainties, it's better just to pay a tad more for one year only.&lt;br /&gt;
&lt;br /&gt;
The process of buying SSL is quite involved:&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;You pay for the SSL order first, and you get 1 ssl credit in Godaddy account.&lt;/li&gt;
&lt;li&gt;You configure the credit, and submit the whole body text from mysite.csr.&lt;/li&gt;
&lt;li&gt;Download the ssl, select type "other" in the dropdown, since I use nginx. &lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;3. Install SSL on Nginx&lt;/h3&gt;
Godaddy email you the zip file contains 2 files: www.mysite.com.crt and gd_bundle.crt. &lt;b&gt;You need to combine both files into one file&lt;/b&gt;, with your domain ssl file on top. so unzip the zip file and combine them.&lt;br /&gt;
&lt;code class="console"&gt;cat www.mysite.com.crt gd_bundle.crt &gt; mysite_combined.crt&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
If you don't combine them, browser will not be able to verify certificate authority (CA), and popup dialog or warning messages, which will certainly scare your site visitors away.&lt;br /&gt;
&lt;br /&gt;
Now copy both combined crt and www.mysite.com.key files to your ssl folder on the server, and edit your nginx.conf&lt;br /&gt;
&lt;code&gt;
server {
    listen          443;
    server_name     www.mysite.com;

    ssl on;
    ssl_certificate         /your/ssl/folder/mysite_combined.crt;
    ssl_certificate_key     /your/ssl/folder/www.mysite.com.key;
    ...
}
&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
then reload the processes to make the change take effect.&lt;br /&gt;
&lt;code class="console"&gt;/etc/init.d/nginx reload&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
That's it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Reference&lt;/h3&gt;
&lt;a href="http://wiki.codemongers.com/NginxHttpSslModule"&gt;http://wiki.codemongers.com/NginxHttpSslModule&lt;/a&gt;
&lt;a href="http://blog.imperialdune.com/2007/3/31/setting-up-godaddy-turbo-ssl-on-nginx"&gt;http://blog.imperialdune.com/2007/3/31/setting-up-godaddy-turbo-ssl-on-nginx&lt;/a&gt;</content>
  </entry>
</feed>
