试验系统:debian7 32 位
虚拟化架构:openvz
1、删除系统预装的 apache2
- #apt - get--purge remove apache2.2#apt - get--purge remove apache2 - doc#apt - get--purge remove apache2 - utils
- #dpkg -l | grep apache2
2、增加国内源(推荐)
文件, 在文件最前面添加以下条目
- #vi /etc/apt/sources.list
- deb http: //mirrors.aliyun.com/debian/ wheezy main non-free contrib
- deb http: //mirrors.aliyun.com/debian/ wheezy-proposed-updates main non-free contrib
- deb - src http: //mirrors.aliyun.com/debian/ wheezy main non-free contrib
- deb - src http: //mirrors.aliyun.com/debian/ wheezy-proposed-updates main non-free contrib
3、使用 nginx 官方源安装 nginx ()
- #wget http: //nginx.org/keys/nginx_signing.key
- #apt - key add nginx_signing.key
在文件最前面添加以下条目
- #vi /etc/apt/sources.list
- deb http: //nginx.org/packages/debian/ wheezy nginx
- deb - src http: //nginx.org/packages/debian/ wheezy nginx
- #apt - get update#apt - get install nginx
,例如:
- http://ip
- http://10.10.10.4
4、安装设置 php5-fpm(默认为 php5.4)
- #apt - get update#apt - get install php5 - fpm
文件,在最上面加入以下条目
- #vi /etc/nginx/fastcgi_params
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
文件,找到
- #vi /etc/php5/fpm/pool.d/www.conf
改成
- listen = /var/run/php5-fpm.sock
- listen = /tmp/php5-fpm.sock
- #service php5-fpm restart
文件,清空并替换以下内容
- #vi /etc/nginx/conf.d/default.conf
- server {
- listen 80;#listen[: :] : 80;
- server_name localhost;
- index index.html index.htm index.php
- default.html
- default.htm
- default.php;
- root / usr / share / nginx / html;#error_page 404 / 404.html;
- location~ [ ^ /]\.php(/ | $) {
- try_files $uri = 404;
- fastcgi_pass unix: /tmp/php5 - fpm.sock;
- fastcgi_index index.php;
- include fastcgi_params;
- }
- location~. * \. (gif | jpg | jpeg | png | bmp | swf) $ {
- expires 30d;
- }
- location~. * \. (js | CSS) ? $ {
- expires 12h;
- }
- location~ / \. {
- deny all;
- }#access_log / www / wwwroot / aaa.com / logs / aaa.com.log;
- }
- #service nginx restart
,内容如下
- #vi /usr/share/nginx/html/i.php
- <?php phpinfo(); ?>
,例如:
- http://ip/i.php
- http://10.10.10.4/i.php
5、MYSQL5.5 安装
- #apt - get update#apt - get install libaio1 libaio - dev
- Linux - Generic 2.6 (x86, 32-bit), Compressed TAR Archive
- #cd / tmp#wget http: //dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.53-linux2.6-i686.tar.gz
- #tar - zxvf mysql - 5.5.53 - linux2.6 - i686.tar.gz#cd mysql - 5.5.53 - linux2.6 - i686
注意:目录结尾不要加 /
- #cp mysql - 5.5.53 - linux2.6 - i686 / usr / local / mysql - r#groupadd mysql
- #groupadd mysql#useradd - r - g mysql mysql
- #cd / usr / local / mysql#chown - R mysql: mysql. / #. / scripts / mysql_install_db--user = mysql#chown - R root: root. / #chown - R mysql: mysql data
- #cp support - files / mysql.server / etc / init.d / mysql#service mysql start
看到 mysql 服务说明启动成功
- #ps -ef|grep mysql
- #. / bin / mysqladmin - u root password 'haixia.net'
来源: http://www.cnblogs.com/haixianet/p/5986646.html