PHP学习Linux学习|Gentoo/Arch/FreeBSD

apt-get方式:debian7 + nginx最新版 + p

2016-10-23  本文已影响0人  eaa6194de772

试验系统:debian7 32位

虚拟化架构:openvz

1、删除系统预装的apache2

#apt-get --purge remove apache2.2
#apt-get --purge remove apache2-doc
#apt-get --purge remove apache2-utils

2、增加国内源(推荐aliyun源

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官方源安装nginxnginx官方源

#wget http://nginx.org/keys/nginx_signing.key
#apt-key add nginx_signing.key
deb http://nginx.org/packages/debian/ wheezy nginx
deb-src http://nginx.org/packages/debian/ wheezy nginx
#apt-get update
#apt-get install nginx

4、安装设置php5-fpm(默认为php5.4)

#apt-get update
#apt-get install php5-fpm
fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
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:/var/run/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;
    }
<?php
phpinfo();
?>

5、MYSQL5.5安装

#apt-get update
#apt-get install mysql-server

6、其它

#apt-get install php5-mysqlnd

ps:不安装php5-mysqlnd驱动下面的phpmyadmin访问时会提示"缺少 mysqli|mysql 扩展"

#cd /usr/share/nginx/html
#wget https://files.phpmyadmin.net/phpMyAdmin/4.4.15.8/phpMyAdmin-4.4.15.8-all-languages.tar.gz
#tar -zxvf phpMyAdmin-4.4.15.8-all-languages.tar.gz
#rm phpMyAdmin-4.4.15.8-all-languages.tar.gz
#mv phpMyAdmin-4.4.15.8-all-languages phpmyadmin

访问测试 http://ip/phpmyadmin,例如:http://10.10.10.4/phpmyadmin

#apt-get install php5-gd

ps:安装phpcms时提示缺少GD扩展无法继续

上一篇 下一篇

猜你喜欢

热点阅读