首先安装如下文件,安装不用多讲了:
apt-get install mysql apt-get install php5-mysql apt-get install nginx apt-get install php5-cgi apt-get install spawn-fcgi apt-get install vsftpd
fast-cgi的安装:
root@ubuntu:/var/www/nginx-default# /usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -C 15 -u nginx -g nginx -f /usr/bin/php-cgi spawn-fcgi: child spawned successfully: PID: 3042 root@ubuntu:/var/www/nginx-default# netstat -an|grep 9000 tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN
修改nginx的配置文件:
root@ubuntu:/# vim /etc/nginx/nginx.conf
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log;
#error_log /var/log/nginx/error.log notice;
#error_log /var/log/nginx/error.log info;
pid /var/run/nginx.pid;
#----------------------------------------------------------------------
# Events Module
#
# http://wiki.nginx.org/NginxHttpEventsModule
#
#----------------------------------------------------------------------
events {
worker_connections 1024;
}
#----------------------------------------------------------------------
# HTTP Core Module
#
# http://wiki.nginx.org/NginxHttpCoreModule
#
#----------------------------------------------------------------------
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
# Load config files from the /etc/nginx/conf.d directory
include /etc/nginx/conf.d/*.conf;
#
# The default server
#
server {
listen 80;
server_name _;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root /var/www/html;
index index.html index.htm index.php;
}
error_page 404 /404.html;
location = /404.html {
root /var/www/html;
}
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /var/www/html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/html/$fastcgi_script_name;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
}
接下来VSftpd的配置:
1.添加用户:
useradd –d /var/www/html face
2.改变网站目录权限:
chown –R face /var/www/html
chmod 755 /var/www/html #这一步最好看一下,比如我改为777的时候反而会无法上传!
3.vim /etc/vsftpd.conf
write_enable=YES #这行注释掉,否则无法上传
local_umask=022 #这行也要注释掉
4.当然锁定用户家目录最好同时开启
chroot_local_user=YES #注释这行比较方便,如果是chroot_list_enable=YES,则下面的列表也要注释掉,同时列表里得写上相应的用户名信息
—————————————————问题解决————————————————-
phpmyadmin的问题汇总:
无法加载 mcrypt (外链,英语) 扩展,请检查您的 PHP 配置。
问题解决
1.安装apt-get install php5-mcrypt
2.编辑php配置文件vim /etc/php5/cgi/php.ini找到mcrypt并在下面添加红色行:
[mcrypt]
; For more information about mcrypt settings see http://php.net/mcrypt-module-open
; Directory where to load mcrypt algorithms
; Default: Compiled in into libmcrypt (usually /usr/local/lib/libmcrypt)
;mcrypt.algorithms_dir=
mcrypt.algorithms_dir=/etc/bash_completion.d/mcrypt
3.添加完成后注意要重启fast-cgi:
root@ubuntu:/# killall -9 php-cgi
root@ubuntu:/# /usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -C 20 -u nginx -g nginx -f /usr/bin/php5-cgi
短语密码配置。
问题解决
配置文件现在需要一个短语密码$cfg['blowfish_secret'] = ‘malu’;
将phpmyadmin/libraries/config.default.php 中的
$cfg['blowfish_secret'] = ”; 改成 $cfg['blowfish_secret'] = ‘malu’;
注:其中的’malu’为随意的字符。
链接表的附加功能尚未激活。要查出原因,请点击此处。
问题解决
1.使用phpMyAdmin的导入功能导入scripts文件夹中的create_tables.sql文件。
2.修改config.inc.php文件,在其中添加:
/* User for advanced features */ $cfg['Servers'][$i]['controluser'] = 'root'; $cfg['Servers'][$i]['controlpass'] = 'malu'; /* Advanced phpMyAdmin features */ $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin'; $cfg['Servers'][$i]['bookmarktable'] = 'pma_bookmark'; $cfg['Servers'][$i]['relation'] = 'pma_relation'; $cfg['Servers'][$i]['table_info'] = 'pma_table_info'; $cfg['Servers'][$i]['table_coords'] = 'pma_table_coords'; $cfg['Servers'][$i]['pdf_pages'] = 'pma_pdf_pages'; $cfg['Servers'][$i]['column_info'] = 'pma_column_info'; $cfg['Servers'][$i]['history'] = 'pma_history'; $cfg['Servers'][$i]['tracking'] = 'pma_tracking'; $cfg['Servers'][$i]['designer_coords'] = 'pma_designer_coords';
3.注意config.inc.php文件放在phpmyadmin的根目录下,同时
$cfg['blowfish_secret'] = ‘malu’; /*这行记得加上,短语密码*/
使用配置文件中定义的控制用户连接失败。
修改config.inc.php文件,看红色那行写上用户名和密码:
/* User for advanced features */
$cfg['Servers'][$i]['controluser'] = 'root';
$cfg['Servers'][$i]['controlpass'] = 'malu';
/* Advanced phpMyAdmin features */
$cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
$cfg['Servers'][$i]['bookmarktable'] = 'pma_bookmark';
$cfg['Servers'][$i]['relation'] = 'pma_relation';
$cfg['Servers'][$i]['table_info'] = 'pma_table_info';
$cfg['Servers'][$i]['table_coords'] = 'pma_table_coords';
$cfg['Servers'][$i]['pdf_pages'] = 'pma_pdf_pages';
$cfg['Servers'][$i]['column_info'] = 'pma_column_info';
$cfg['Servers'][$i]['history'] = 'pma_history';
$cfg['Servers'][$i]['tracking'] = 'pma_tracking';
$cfg['Servers'][$i]['designer_coords'] = 'pma_designer_coords';
由于Ubuntu不像REDHAT那样有chkconfig命令可以查看服务,给出Ubuntu下查看当前服务的脚本:
ls /etc/rc$(runlevel|sed 's/N.//').d|awk '!/K/ {print}'|sed 's/S[0-9][0-9]//'
同时要想下次重启随机启动,把启动命令写入/etc/init.d/rc.local里就可以啦:
/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -C 100 -u nginx -g nginx -f /usr/bin/php5-cgi /etc/init.d/mysql start /etc/init.d/vsftpd start
注意nginx是不需要写的,默认已经随机启动了。
完成了,天啊天黑了,给图:
2010年11月27日,马路的博客原创http://bolg.malu.me/html/2010/594.html转载注明出处