cd /root
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
wget http:
//kukk.tk/down/nginx/nginx-0.7.61-1.i386.rpm
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
wget http:
//kukk.tk/down/nginx/spawn-fcgi-1.6.2-1.32.i386.rpm
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
yum -y install mysql-server
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
yum -y install php-mysql
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
yum -y install php-cli
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
rpm -ivh nginx-0.7.61-1.i386.rpm spawn-fcgi-1.6.2-1.32.i386.rpm
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
/etc/init.d/mysqld restart
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
mysqladmin -u root password kukk
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
为mysql设置密码:
mysqladmin -u root password kukk
可以用下面语句登录测试:
root@Ubuntu:/# mysql -p
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
Enter password:
开启fastcgi的进程:
/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -C 15 -u nginx -g nginx -f /usr/bin/php-cgi
顺便写上关闭该进程的方法:
killall -9 php-cgi
查找到该进程:
netstat -an |grep 9000
编辑nginx的配置文件:
vim /etc/nginx/nginx.conf
user nginx;
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
worker_processes 1;
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
error_log /var/log/nginx/error.log;
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
#error_log /var/log/nginx/error.log notice;
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
#error_log /var/log/nginx/error.log info;
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
pid /var/run/nginx.pid;
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
#----------------------------------------------------------------------
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
# Events Module
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
#
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
# http:
//wiki.nginx.org/NginxHttpEventsModule
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
#
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
#----------------------------------------------------------------------
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
events {
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
worker_connections 1024;
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
}
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
#----------------------------------------------------------------------
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
# HTTP Core Module
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
#
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
# http:
//wiki.nginx.org/NginxHttpCoreModule
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
#
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
#----------------------------------------------------------------------
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
http {
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
include /etc/nginx/mime.types;
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
default_type application/octet-stream;
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
log_format main '$remote_addr - $remote_user [$time_local]
"$request" '
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
'$status $body_bytes_sent
"$http_referer" '
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
'
"$http_user_agent"
"$http_x_forwarded_for"';
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
access_log /var/log/nginx/access.log main;
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
sendfile on;
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
#tcp_nopush on;
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
#keepalive_timeout 0;
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
keepalive_timeout 65;
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
#gzip on;
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
# Load config files from the /etc/nginx/conf.d directory
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
include /etc/nginx/conf.d/*.conf;
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
#
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
# The
default server
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
#
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
server {
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
listen 80;
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
server_name _;
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
#charset koi8-r;
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
#access_log logs/host.access.log main;
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
location / {
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
root /var/www/html;
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
index index.html index.htm index.php;
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
}
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
error_page 404 /404.html;
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
location = /404.html {
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
root /var/www/html;
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
}
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
# redirect server error pages to the
static page /50x.html
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
#
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
error_page 500 502 503 504 /50x.html;
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
location = /50x.html {
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
root /var/www/html;
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
}
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
#
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
#location ~ \.php$ {
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
# proxy_pass http:
//127.0.0.1;
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
#}
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
location ~ \.php$ {
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
root html;
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
fastcgi_pass 127.0.0.1:9000;
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
fastcgi_index index.php;
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
fastcgi_param SCRIPT_FILENAME /var/www/html/$fastcgi_script_name;
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
include fastcgi_params;
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
}
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
# deny access to .htaccess files,
if Apache's document root
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
# concurs with nginx's one
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
#
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
#location ~ /\.ht {
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
# deny all;
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
#}
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
}
![InBlock.gif](p_w_picpaths/editer/InBlock.gif)
}