|
|
18Mar/110
Building PHP Webserver on Nginx with PHP CGI
Doesn't like the Apache webserver, nginx didn't have the auto-configuration feature from PHP and library loading. The way to make nginx be a PHP webserver is passing the request to PHP CGI. How?
The first step must be installing the nginx and php5 package. For this post i'm using Ubuntu 10.04 LTS.
apt-get update nginx apt-get update php5
Check your nginx installation with start the service:
service nginx restart /etc/init.d/nginx restart
Now, if the nginx working, let's connect it to the PHP CGI. First, run the PHP CGI so that the PHP listen at 127.0.0.1 with port 9000.
/usr/bin/php-cgi -b 127.0.0.1:9000 &
After the CGI is running, go to nginx configuration and make a script pass to PHP CGI.
server
{
listen 80 default;
server_name _;
root /var/www/nginx-default;
index index.html index.php;
location ~ \.php$
{
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME /var/www/nginx-default$fastcgi_script_name;
}
}
Related posts:
Google Search
Custom Search
Blogroll
- Alexander Rahardjo
- Andrew P. Goenardi
- Arlisa Yuliawati
- Inge Priangga Abadi
- Jeffrey Hermanto H.
- Lanang Adhitya Nugraha
- M Ulin Nuha
- Rahadian D. Dewandono
- Reza Adhitya Saputra
- Simson P. Situmeang
- Tobias Benito
Member Of
Miscellaneous
Categories
- Computer (47)
- Database (7)
- IDE (3)
- NetBeans (2)
- Samsung Smart TV SDK (1)
- Manufacturer (2)
- Networking (14)
- Operating System (9)
- Programming (35)
- C (10)
- C# (9)
- C++ (1)
- Java (9)
- Javascript (1)
- PHP (4)
- SmallBasic (1)
- Security (2)
- Games (2)
- ConsoleGames (1)
- FlashGames (1)
- WebGames (1)
- Life (3)
- International (1)
- National (1)
- Personal (1)
- Mobile Device (6)
- Android (3)
- Samsung (2)
- Sony Ericsson (2)
- Multimedia (1)
- Video (1)
- Travel (3)




