<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>experimental &#187; Web Servers</title>
	<atom:link href="http://www.tajidyakub.com/category/web-servers/feed" rel="self" type="application/rss+xml" />
	<link>http://www.tajidyakub.com</link>
	<description>Experience the Experiment</description>
	<lastBuildDate>Sat, 10 Oct 2009 19:32:38 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Removing Nginx Server Version</title>
		<link>http://www.tajidyakub.com/web-servers/removing-nginx-server-version-2008-07-31.html</link>
		<comments>http://www.tajidyakub.com/web-servers/removing-nginx-server-version-2008-07-31.html#comments</comments>
		<pubDate>Wed, 30 Jul 2008 19:52:37 +0000</pubDate>
		<dc:creator>Tajid Yakub</dc:creator>
				<category><![CDATA[Web Servers]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[server tokens]]></category>

		<guid isPermaLink="false">http://tajidyakub.com/?p=16</guid>
		<description><![CDATA[Just add the following configuration on http {} directive inside your nginx.conf
http {
...
server_tokens   off;
...
}
]]></description>
			<content:encoded><![CDATA[<p>Just add the following configuration on http {} directive inside your nginx.conf</p>
<pre class="brush: bash">http {
...
server_tokens   off;
...
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.tajidyakub.com/web-servers/removing-nginx-server-version-2008-07-31.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTTPS, SSL and Nginx</title>
		<link>http://www.tajidyakub.com/web-servers/https-ssl-and-nginx-2008-07-27.html</link>
		<comments>http://www.tajidyakub.com/web-servers/https-ssl-and-nginx-2008-07-27.html#comments</comments>
		<pubDate>Sat, 26 Jul 2008 18:37:15 +0000</pubDate>
		<dc:creator>Tajid Yakub</dc:creator>
				<category><![CDATA[Web Servers]]></category>
		<category><![CDATA[certificate]]></category>
		<category><![CDATA[https]]></category>
		<category><![CDATA[ssl]]></category>

		<guid isPermaLink="false">http://tajidyakub.com/?p=15</guid>
		<description><![CDATA[Say you want to run https port on nginx using a self signed SSL Certificate, this article summarized the steps. First we create the SSL Key, CSR (Certificate Signing Request) and CRT (SSL Certificate) and Configure nginx to answer the request from SSL port.

These are the original articles;
http://rubyjudo.com/2006/11/2/nginx-ssl-rails
http://articles.slicehost.com/2007/12/19/ubuntu-gutsy-self-signed-ssl-certificates-and-nginx
 http://blog.skateinmars.net/post/2007/11/01/phpMyAdmin-and-HTTPS-on-nginx
The aim is to run phpMyAdmin in [...]]]></description>
			<content:encoded><![CDATA[<p>Say you want to run https port on nginx using a self signed SSL Certificate, this article summarized the steps. First we <strong>create the SSL Key, CSR (Certificate Signing Request) and CRT (SSL Certificate) and Configure nginx</strong> to answer the request from SSL port.</p>
<p><span id="more-15"></span></p>
<p><strong>These are the original articles;</strong></p>
<p><a href="http://articles.slicehost.com/2007/12/19/ubuntu-gutsy-self-signed-ssl-certificates-and-nginx" target="_blank">http://rubyjudo.com/2006/11/2/nginx-ssl-rails<br />
</a><a href="http://articles.slicehost.com/2007/12/19/ubuntu-gutsy-self-signed-ssl-certificates-and-nginx" target="_blank">http://articles.slicehost.com/2007/12/19/ubuntu-gutsy-self-signed-ssl-certificates-and-nginx</a><br />
<a href="http://blog.skateinmars.net/post/2007/11/01/phpMyAdmin-and-HTTPS-on-nginx" target="_blank"> http://blog.skateinmars.net/post/2007/11/01/phpMyAdmin-and-HTTPS-on-nginx</a></p>
<p>The aim is to run <a title="phpMyAdmin" href="http://www.phpmyadmin.net/" target="_blank">phpMyAdmin</a> in secured mode served by <a title="Nginx" href="http://nginx.net" target="_blank">nginx</a>.<br />
<strong></strong></p>
<p><strong>Create Keys and Certificates</strong></p>
<p>Make a temp directory and remove it later after the setup succeed.</p>
<pre class="brush: bash">mkdir /home/username/temp
cd /home/username/temp
</pre>
<p>Create the private key, it will require a passphrase (it will be removed later on)</p>
<pre class="brush: bash">openssl genrsa -des3 -out pma.key 1024</pre>
<p>Create the CSR (Certificate Signing Request), and enter the information required;</p>
<pre class="brush: bash">openssl req -new -key pma.key -out pma.csr</pre>
<p>Then we remove the passphrase entered earlier when we create the key, if not, the box will ask us to enter the passphrase on every reboot.</p>
<pre class="brush: bash">cp pma.key pma.key.org
openssl rsa -in pma.key.org -out pma.key</pre>
<p>Afterward, the digital certificate itself</p>
<pre class="brush: bash">openssl x509 -req -days 365 -in pma.csr -signkey pma.key -out pma.crt</pre>
<p>The last thing is to put the files in the right place, to be called later by nginx, the final directory will depend on your config, in my case I want to put it inside nginx directory.</p>
<pre class="brush: bash">mkdir /usr/local/nginx/cert
cp pma.crt pma.key /usr/local/nginx/cert</pre>
<p>Feel free to delete the temporary directory created for this purpose, or you might want to wait until your setup is done.</p>
<p><strong>Nginx Virtual Host HTTPS</strong></p>
<p>This is my final setup on phpMyAdmin subdomain (only the server part), I really can&#8217;t explain anything for now :), I just now it worked.</p>
<pre class="brush: bash">server {
listen pma.yourdomain.com:443;
client_max_body_size 10M;
index index.php;
server_name pma.yourdomain.com;
root /var/www/pma.yourdomain.com;

ssl on;
ssl_certificate /usr/local/nginx/certs/pma.crt;
ssl_certificate_key /usr/local/nginx/certs/pma.key;

location / {
proxy_set_header X_FORWARDED_PROTO https;
proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect false;
proxy_max_temp_file_size 0;
}

location ~ .php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param HTTPS on;
include /usr/local/nginx/conf/fastcgi_params;

}

}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.tajidyakub.com/web-servers/https-ssl-and-nginx-2008-07-27.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nginx, MySQL, PHP in CentOS 5.1 (x86_64)</title>
		<link>http://www.tajidyakub.com/web-servers/nginx-mysql-php-in-centos-51-x86_64-2008-06-28.html</link>
		<comments>http://www.tajidyakub.com/web-servers/nginx-mysql-php-in-centos-51-x86_64-2008-06-28.html#comments</comments>
		<pubDate>Sat, 28 Jun 2008 03:29:29 +0000</pubDate>
		<dc:creator>Tajid Yakub</dc:creator>
				<category><![CDATA[Web Database]]></category>
		<category><![CDATA[Web Programming]]></category>
		<category><![CDATA[Web Servers]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://tajidyakub.com/?p=13</guid>
		<description><![CDATA[Nginx (pronounced &#8220;engine x&#8221;) is a free, open-source, high-performance HTTP server and reverse proxy, as well as an IMAP/POP3 proxy server. Written by Igor Sysoev in 2005, still in beta, Nginx is known for its stability, rich feature set, simple configuration, and low resource consumption, taken from the wiki. I will not go deeper on [...]]]></description>
			<content:encoded><![CDATA[<p><a title="Nginx" href="http://nginx.net" target="_blank">Nginx</a> (pronounced &#8220;engine x&#8221;) is a free, open-source, high-performance HTTP server and reverse proxy, as well as an IMAP/POP3 proxy server. Written by <a title="Nginx Developer" href="http://sysoev.ru/en/" target="_blank">Igor Sysoev</a> in 2005, still in beta, Nginx is known for its stability, rich feature set, simple configuration, and low resource consumption, <a title="nginx wiki" href="http://wiki.codemongers.com/Main" target="_blank">taken from the wiki</a>. I will not go deeper on the subject of nginx as a preferrable alteranate HTTP Server asides from <a title="Apache HTTP Server" href="http://httpd.apache.org/" target="_blank">Apache</a>, since I don&#8217;t have a lot of knowledge on the subject.</p>
<p>This article intends to show you a step by step tutorial on how to install (and do basic configuration) for Nginx powered Web Sites with <a title="PHP Site" href="http://php.net" target="_blank">PHP</a> (through <a title="php-fpm" href="http://php-fpm.anight.org/" target="_blank">php-fpm</a>) and <a title="MySQL" href="http://mysql.com/" target="_blank">MySQL</a> Enabled in <a title="CentOS!" href="http://centos.org" target="_blank">CentOS 5.1</a> (x86_64) Virtual Box. The Box is from <a title="Magnet Hosting and Server" href="http://magnet-id.com" target="_blank">Magnet VPS</a> (Entry with 128MB Dedicated RAM, 256MB SWAP Space and 5GB HDD Space).</p>
<p><span id="more-13"></span></p>
<p><strong>Install and Securing (Basic) MySQL</strong></p>
<pre class="brush: bash">

yum install -y mysql-server mysql-devel
service mysqld start
mysql_secure_installation

Enter current password for root (enter for none): Enter
Set root password? [Y/n] Y
New password: rootpasssql
Re-enter new password: rootpasssql
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] Y
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y
</pre>
<p><strong>Install Required Package for Compiling</strong></p>
<p>We need to install a few basic package since this is a very base install of CentOS, some of the package will depend on your wanted php configuration.</p>
<pre class="brush: bash">

yum install -y wget patch gcc libtool libmcrypt-devel libxml2-devel flex bison make pcre-devel zlib-devel openssl-devel gd-devel
</pre>
<p><strong>Install PHP From Source</strong></p>
<p>We are going to install PHP 5.2.6 along with php-fpm patch (patch for PHP to improve FastCGI SAPI Usage in Production)</p>
<pre class="brush: bash">
cd /usr/local/src
wget http://id2.php.net/get/php-5.2.6.tar.gz/from/id2.php.net/mirror
tar xzvf php-5.2.6.tar.gz
wget http://php-fpm.anight.org/downloads/head/php-5.2.6-fpm-0.5.8.diff.gz
gzip -cd php-5.2.6-fpm-0.5.8.diff.gz | patch -d php-5.2.6 -p1
cd php-5.2.6
./configure --enable-fastcgi --enable-fpm --with-mcrypt --with-zlib --enable-mbstring --with-openssl --with-mysql --with-mysql-sock --with-gd --with-jpeg-dir=/usr/lib --enable-gd-native-ttf --without-sqlite --disable-pdo --disable-reflection --with-libdir=lib64
make all install
strip /usr/local/bin/php-cgi
</pre>
<p>Adjust php-fpm configuration, remove the comment sign in line 63 and 65, adjust the user in which nginx will run, in this example I am using nobody (default)</p>
<pre class="brush: bash">
vi /usr/local/etc/php-fpm.conf
&lt;value name=&quot;user&quot;&gt;nobody&lt;/value&gt;
&lt;value name=&quot;group&quot;&gt;nobody&lt;/value&gt;
</pre>
<p>Now we will install X-Cache opcode php cacher</p>
<pre class="brush: bash">
cd /usr/local/src
wget http://xcache.lighttpd.net/pub/Releases/1.2.2/xcache-1.2.2.tar.gz
tar xzvf xcache-1.2.2.tar.gz
cd xcache-1.2.2
phpize
./configure --with-php-config=/usr/local/bin/php-config --enable-xcache
make install
</pre>
<p>Insert xcache in php.ini</p>
<pre class="brush: bash">

vi /usr/local/lib/php.ini

magic_quotes_gpc=0
[xcache-common]
zend_extension = /usr/local/lib/php/extensions/no-debug-non-zts-20060613/xcache.so
[xcache]
xcache.shm_scheme = &quot;mmap&quot;
xcache.size = 64M
</pre>
<p>Check your PHP Installation</p>
<pre class="brush: bash">
php -v
PHP 5.2.6 (cli) (built: Jun 28 2008 08:56:02)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
with XCache v1.2.2, Copyright (c) 2005-2007, by mOo
</pre>
<p><strong>Init Script for php-fpm</strong></p>
<p>Put php-fpm init script in your rc.local to auto start during reboot</p>
<pre class="brush: bash">
cd /etc/init.d/
ln -s /usr/local/sbin/php-fpm php-fpm

## add this line to /etc/rc.local ##
/etc/init.d/php-fpm
</pre>
<p><strong>Install Nginx</strong></p>
<p>Now we will install nginx, the current stable version is 0.6.31, check their site for updates;</p>
<pre class="brush: bash">
export NGINX=0.6.31
cd /usr/local/src
wget http://sysoev.ru/nginx/nginx-${NGINX}.tar.gz
tar xfz nginx-${NGINX}.tar.gz
cd nginx-${NGINX}
./configure --pid-path=/usr/local/nginx/logs/nginx.pid --sbin-path=/usr/local/sbin/nginx --with-md5=/usr/lib --with-sha1=/usr/lib --with-http_ssl_module  --with-http_dav_module --without-mail_pop3_module --without-mail_imap_module --without-mail_smtp_module
make
make install
</pre>
<p><strong>Nginx Daemon for CentOS</strong></p>
<p>Get Nginx daemon for CentOS and add the service to startup so it start automatically during reboot.</p>
<pre class="brush: bash">
wget http://notrocketsurgery.com/files/nginx -O /etc/init.d/nginx
chmod 750 /etc/init.d/nginx
## Install start-stop-daemon ##
cd /usr/local/src
wget http://developer.axis.com/download/distribution/apps-sys-utils-start-stop-daemon-IR1_9_18-1.tar.gz
tar zxvf apps-sys-utils-start-stop-daemon-IR1_9_18-1.tar.gz
cd apps/sys-utils/start-stop-daemon-IR1_9_18-1/
gcc start-stop-daemon.c -o start-stop-daemon
cp start-stop-daemon /usr/sbin
chkconfig --add nginx
chkconfig --level 345 nginx on
</pre>
<p><strong>Configure Nginx</strong></p>
<p>This is a sample configuration for wordpress running on nginx web sites. Notice that I am disabling logs, the sample is only for basic configuration, you should read more on nginx manual for the configuration directive.</p>
<pre class="brush: bash">

service nginx start
## Edit the main configuration File ##
vi /usr/local/nginx/conf/nginx.conf
## Put only these lines ##
user  nobody;
worker_processes  5;
error_log  /var/log/nginx/error.log;
events {
worker_connections  768;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
tcp_nodelay on;
keepalive_timeout 10 10;
gzip on;
gzip_comp_level 1; gzip_proxied any;
gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;

server {
listen  80;
server_name your.hostname.tld;
location / {
root   html;
autoindex  off;
index  index.html index.htm;
}
}
include /usr/local/nginx/sites-enabled/*;
}

## Make a sites config ##
cd /usr/local/nginx
mkdir sites-enabled
cd sites-enabled
vi yourwordpressblog.tld

## Put these lines ##

server {
listen yourwordpressblog.tld:80;
server_name yourwordpressblog.tld www.yourwordpressblog.tld;
index index.php;
root /var/www/yourwordpressblog.tld;

location / {
error_page 404 = //index.php?q=$uri;
}

location ~ .php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include /usr/local/nginx/conf/fastcgi_params;
}
}

## Add this line to fastcgi_params /usr/local/nginx/fastcgi_params##
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
</pre>
<p>Make the root www directory for your wordpressblog, this is subject for security notice in the future, I haven&#8217;t look further.</p>
<pre class="brush: bash">
mkdir -p /var/www/yourwordpressblog.tld
touch /var/www/yourwordpressblog.tld/index.php
chown -R nobody.nobody /var/www/yourwordpressblog.tld
</pre>
<p>Restart nginx, but make sure that your domain already resolved to your nginx web server, otherwise it will fail to start.</p>
<pre class="brush: bash">
service nginx restart
</pre>
<h2>Update</h2>
<p>It is now CentOS 5.3, PHP and fpm patch 5.2.10, and nginx 0.7.61 stable release. This post is obsolete, unless you can modify the steps.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tajidyakub.com/web-servers/nginx-mysql-php-in-centos-51-x86_64-2008-06-28.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Installation and Basic Configuration Apache, MySQL and PHP on CentOS 5.1 (64 bit)</title>
		<link>http://www.tajidyakub.com/web-servers/installation-and-basic-configuration-apache-mysql-and-php-on-centos-51-64-bit-2008-06-27.html</link>
		<comments>http://www.tajidyakub.com/web-servers/installation-and-basic-configuration-apache-mysql-and-php-on-centos-51-64-bit-2008-06-27.html#comments</comments>
		<pubDate>Thu, 26 Jun 2008 18:48:05 +0000</pubDate>
		<dc:creator>Tajid Yakub</dc:creator>
				<category><![CDATA[Web Database]]></category>
		<category><![CDATA[Web Programming]]></category>
		<category><![CDATA[Web Servers]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://tajidyakub.com/?p=11</guid>
		<description><![CDATA[These are the simple steps to Install and do basic configuration Apache 2.2.3, MySQL 5.0.22 and PHP on a base install CentOS 5.1 x86_64.

Required Pack
Install the required package using yum;


yum install gettext httpd mysql mysql-server perl

yum install php php-mysql php-xml php-imap php-mbstring php-mcrypt php-pecl-Fileinfo php-pecl-memcache php-pear-DB php-pear-File php-pear-Log php-pear-Mail-Mime php-pear-Auth-SASL php-pear-Date php-pear-HTTP-Request php-pear-Mail php-pear-Net-Sieve php-pear-Net-Socket [...]]]></description>
			<content:encoded><![CDATA[<p>These are the simple steps to Install and do basic configuration Apache 2.2.3, MySQL 5.0.22 and PHP on a base install CentOS 5.1 x86_64.</p>
<p><span id="more-11"></span></p>
<p><strong>Required Pack</strong></p>
<p>Install the required package using yum;</p>
<pre class="brush: bash">

yum install gettext httpd mysql mysql-server perl

yum install php php-mysql php-xml php-imap php-mbstring php-mcrypt php-pecl-Fileinfo php-pecl-memcache php-pear-DB php-pear-File php-pear-Log php-pear-Mail-Mime php-pear-Auth-SASL php-pear-Date php-pear-HTTP-Request php-pear-Mail php-pear-Net-Sieve php-pear-Net-Socket php-pear-Net-SMTP

yum install openssl perl-Net-SSLeay

yum install php-devel gcc
</pre>
<p><strong>Start the Service</strong></p>
<p>Start Apache and MySQL daemon, and add them to startup script so it will survive reboot.</p>
<pre class="brush: bash">

service httpd restart
chkconfig httpd on

service mysqld restart
chkconfig mysqld on
</pre>
<p><strong>Standard MySQL First Step After Install</strong></p>
<p>Run the mysql_secure script to do basic securing MySQL and give root password to your MySQL databases;</p>
<pre class="brush: bash">mysql_secure_installation</pre>
<p><strong>Apache and Basic Virtual Host Configuration</strong></p>
<p>Edit the apache configuration file to fit your requirement.</p>
<pre class="brush: bash">

vi /etc/httpd/conf/httpd.conf

###Modify

Listen vvv.xxx.yyy.zzz:80  &lt;--Put your IP Address here

###Add

&lt;Directory “/path/to/rootwwwdir/public_html”&gt;
Options Indexes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
AllowOverride None
&lt;/Directory&gt;

&lt;Directory “/path/to/rootwwwdir/public_html”&gt;
Options Indexes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
AllowOverride None
&lt;/Directory&gt;

Virtual Host Configuration

NameVirtualHost vvv.xxx.yyy.zzz:80

&lt;VirtualHost vvv.xxx.yyy.zzz:80&gt;
ServerAdmin hostmaster@magnet-id.com
DocumentRoot /path/to/rootwwwdir/public_html
ServerName virt1.magnet-id.com
ErrorLog logs/virt1.magnet-id.com-error_log
CustomLog logs/virt1.magnet-id.com-access_log common
&lt;/VirtualHost&gt;

&lt;VirtualHost vvv.xxx.yyy.zzz:80&gt;
ServerAdmin hostmaster@magnet-id.com
DocumentRoot /path/to/rootwwwdir/public_html
ServerName virt2.magnet-id.com
ErrorLog logs/virt2.magnet-id.com-error_log
CustomLog logs/virt2.magnet-id.com-access_log common
&lt;/VirtualHost&gt;

###Empty the file
/etc/httpd/conf.d/welcome.conf
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.tajidyakub.com/web-servers/installation-and-basic-configuration-apache-mysql-and-php-on-centos-51-64-bit-2008-06-27.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
