1 ? centos7 最小化安裝 ?默認(rèn)已裝
cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
2 yum 版本升級(jí) ?如果不是最新 建議升級(jí)一下
安裝epel 源
yum update -y
yum install epel release
安裝remi源
# rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
# rpm --import http://rpms.famillecollet.com/RPM-GPG-KEY-remi
安裝 輔助工具
yum install wget unzip unrar
3 安裝 nginx ? ?當(dāng)前為 nginx1.10.1
yum install ?nginx
啟動(dòng) service nginx start,測(cè)試是否啟動(dòng)成功, 測(cè)試是否正常,用瀏覽器訪問(wèn)http://127.0.0.1。(一般用最小化安裝 黍翎,采用curl ?http://127.0.0.1 訪問(wèn)即可 ?或者 本地ip 訪問(wèn)
正常的話應(yīng)該看到一個(gè)nginx的歡迎頁(yè)面老赤。這個(gè)頁(yè)面就是/usr/share/nginx/html/index.html吵冒,可以自行修改測(cè)試隧膘。
4 安裝 php7 ? ?7.0.10
預(yù)編譯先 ?直接粘代碼即可運(yùn)行 ?
./configure --prefix=/usr/local/php7 --exec-prefix=/usr/local/php7 --bindir=/usr/local/php7/bin --sbindir=/usr/local/php7/sbin --includedir=/usr/local/php7/include --libdir=/usr/local/php7/lib/php --mandir=/usr/local/php7/php/man --with-config-file-path=/usr/local/php7/etc --with-mysql-sock=/var/run/mysql/mysql.sock --with-mcrypt=/usr/include --with-mhash --with-openssl --with-mysql=shared,mysqlnd --with-mysqli=shared,mysqlnd --with-pdo-mysql=shared,mysqlnd --with-gd --with-iconv --with-zlib --enable-zip --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-mbregex --enable-mbstring --enable-ftp --enable-gd-native-ttf --enable-pcntl --enable-sockets --with-xmlrpc --enable-soap --without-pear --with-gettext --enable-session --with-curl --with-jpeg-dir --with-freetype-dir --enable-opcache --enable-fpm --enable-fastcgi --with-fpm-user=nginx --with-fpm-group=nginx --without-gdbm --disable-fileinfo
執(zhí)行安裝php7?
make && make install
5 編輯 nginx的 變量
vi /etc/nginx/conf.d/default.conf
location / {
? ? ? root /usr/share/nginx/html;? ?
? ? ? index index.php index.html index.htm;
}location ~ \.php$ {
# root html;
? ? ? ? fastcgi_pass 127.0.0.1:9000;
? ? ? ? fastcgi_index index.php;
? ? ? ? fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name;
? ? ? ? include fastcgi_params;
?}
6 ?mariadb的安裝
建立mariadb的源
vi ?/etc/yum.repos.d/MariaDB.repo
#MariaDB10.1CentOSrepositorylist-created
#http://mariadb.org/mariadb/repositories/
[mariadb]
name=MariaDB
baseurl=http://yum.mariadb.org/10.1/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
安裝并 執(zhí)行
yum install MariaDB-server MariaDB-client