cd /root
InBlock.gifwget http: //kukk.tk/down/nginx/nginx-0.7.61-1.i386.rpm
InBlock.gifwget http: //kukk.tk/down/nginx/spawn-fcgi-1.6.2-1.32.i386.rpm
InBlock.gifyum -y install mysql-server
InBlock.gifyum -y install php-mysql
InBlock.gifyum -y install php-cli
InBlock.gifrpm -ivh nginx-0.7.61-1.i386.rpm spawn-fcgi-1.6.2-1.32.i386.rpm
InBlock.gif/etc/init.d/mysqld restart
InBlock.gifmysqladmin -u root password kukk
InBlock.gif为mysql设置密码:
InBlock.gif
mysqladmin -u root password kukk
InBlock.gif
可以用下面语句登录测试:
InBlock.gif
root@Ubuntu:/# mysql -p
InBlock.gifEnter password:
InBlock.gif
开启fastcgi的进程:
InBlock.gif
/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -C 15 -u nginx -g nginx -f /usr/bin/php-cgi
InBlock.gif
顺便写上关闭该进程的方法:
InBlock.gif
killall -9 php-cgi
InBlock.gif
查找到该进程:
InBlock.gif
netstat -an |grep 9000
InBlock.gif
编辑nginx的配置文件:
InBlock.gif
vim /etc/nginx/nginx.conf
InBlock.gif

InBlock.gif
user                            nginx;
InBlock.gifworker_processes    1;
InBlock.gif
InBlock.giferror_log    /var/log/nginx/error.log;
InBlock.gif#error_log    /var/log/nginx/error.log    notice;
InBlock.gif#error_log    /var/log/nginx/error.log    info;
InBlock.gif
InBlock.gifpid                /var/run/nginx.pid;
InBlock.gif
InBlock.gif#----------------------------------------------------------------------
InBlock.gif# Events Module
InBlock.gif#
InBlock.gif#     http: //wiki.nginx.org/NginxHttpEventsModule
InBlock.gif#
InBlock.gif#----------------------------------------------------------------------
InBlock.gif
InBlock.gifevents {
InBlock.gif        worker_connections    1024;
InBlock.gif}
InBlock.gif
InBlock.gif#----------------------------------------------------------------------
InBlock.gif# HTTP Core Module
InBlock.gif#
InBlock.gif#     http: //wiki.nginx.org/NginxHttpCoreModule
InBlock.gif#
InBlock.gif#----------------------------------------------------------------------
InBlock.gif
InBlock.gifhttp {
InBlock.gif        include             /etc/nginx/mime.types;
InBlock.gif        default_type    application/octet-stream;
InBlock.gif
InBlock.gif        log_format    main    '$remote_addr - $remote_user [$time_local] "$request" '
InBlock.gif                                            '$status $body_bytes_sent "$http_referer" '
InBlock.gif                                            ' "$http_user_agent" "$http_x_forwarded_for"';
InBlock.gif
InBlock.gif        access_log    /var/log/nginx/access.log    main;
InBlock.gif
InBlock.gif        sendfile                on;
InBlock.gif        #tcp_nopush         on;
InBlock.gif
InBlock.gif        #keepalive_timeout    0;
InBlock.gif        keepalive_timeout    65;
InBlock.gif
InBlock.gif        #gzip    on;
InBlock.gif
InBlock.gif        # Load config files from the /etc/nginx/conf.d directory
InBlock.gif        include /etc/nginx/conf.d/*.conf;
InBlock.gif
InBlock.gif        #
InBlock.gif        # The default server
InBlock.gif        #
InBlock.gif        server {
InBlock.gif                listen             80;
InBlock.gif                server_name    _;
InBlock.gif
InBlock.gif                #charset koi8-r;
InBlock.gif
InBlock.gif                #access_log    logs/host.access.log    main;
InBlock.gif
InBlock.gif                location / {
InBlock.gif                        root     /var/www/html;
InBlock.gif                        index    index.html index.htm index.php;
InBlock.gif                }
InBlock.gif
InBlock.gif                error_page    404                            /404.html;
InBlock.gif                location = /404.html {
InBlock.gif                        root     /var/www/html;
InBlock.gif                }
InBlock.gif
InBlock.gif                # redirect server error pages to the static page /50x.html
InBlock.gif                #
InBlock.gif                error_page     500 502 503 504    /50x.html;
InBlock.gif                location = /50x.html {
InBlock.gif                        root     /var/www/html;
InBlock.gif                }
InBlock.gif
InBlock.gif                # proxy the PHP scripts to Apache listening on 127.0.0.1:80
InBlock.gif                #
InBlock.gif                #location ~ \.php$ {
InBlock.gif                #        proxy_pass     http: //127.0.0.1;
InBlock.gif                #}
InBlock.gif
InBlock.gif                # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
InBlock.gif
InBlock.gif                location ~ \.php$ {
InBlock.gif                        root                     html;
InBlock.gif                        fastcgi_pass     127.0.0.1:9000;
InBlock.gif                        fastcgi_index    index.php;
InBlock.gif                        fastcgi_param    SCRIPT_FILENAME    /var/www/html/$fastcgi_script_name;
InBlock.gif                        include                fastcgi_params;
InBlock.gif                }
InBlock.gif
InBlock.gif                # deny access to .htaccess files, if Apache's document root
InBlock.gif                # concurs with nginx's one
InBlock.gif                #
InBlock.gif                #location ~ /\.ht {
InBlock.gif                #        deny    all;
InBlock.gif                #}
InBlock.gif        }
InBlock.gif}