-
安裝環(huán)境
- Centos6.5
# vi /etc/resolv.conf nameserver 8.8.8.8 nameserver 114.114.114.114
- Centos6.5
-
安裝nginx
1.安裝nginx源
2.yum安裝#rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
3.設(shè)置開(kāi)機(jī)啟動(dòng)#yum -y install nginx
4.啟動(dòng)nginx#chkconfig nginx on
#service nginx start
- 備注
- 查看端口占用
netstat -lntp | grep nginx
- 查看進(jìn)程
ps -ef | grep nginx
-
安裝php
1.檢查是否安裝php
yum list installed | grep php
2.追加CentOS 6.5的epel及remi源。
# rpm -Uvh http://ftp.iij.ad.jp/pub/linux/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
3.安裝php
# yum install --enablerepo=remi --enablerepo=remi-php56 php php-opcache php-devel php-mbstring php-mcrypt php-mysqlnd php-phpunit-PHPUnit php-pecl-xdebug php-pecl-xhprof php-gd php-bcmath -y
4.安裝fpm
#yum install --enablerepo=remi --enablerepo=remi-php56 php-fpm -y
5.設(shè)置開(kāi)機(jī)啟動(dòng)
#chkconfig php-fpm on
6.啟動(dòng)fpm
#/etc/init.d/php-fpm start
-
安裝mysql
1.安裝mysql
#wget http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm
#rpm -ivh mysql-community-release-el6-5.noarch.rpm
#yum repolist all | grep mysql
#yum install mysql-community-server -y
2.設(shè)置開(kāi)機(jī)啟動(dòng)
#chkconfig mysqld on
3.啟動(dòng)
#/etc/init.d/mysqld start
4.拷貝配置文件
#cp /usr/share/mysql/my-medium.cnf /etc/my.cnf
5.設(shè)置密碼
#mysql_secure_installation
-
配置
1.先關(guān)閉防火墻
#service iptables stop
2.修改nginx配置文件
#vi /etc/nginx/conf.d/default.conf
在最底部添加
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /$document_root$fastcgi_script_name;
include fastcgi_params;
}
將root放到server下
root /usr/share/nginx/html;
3.編寫(xiě)phpinfo放到root目錄下
<?php
phpinfo();
?>
4.查看效果