1、关闭iptables
iptables -F
2、关闭SELINUX
vi /etc/selinux/config
#SELINUX=enforcing #注释掉
#SELINUXTYPE=targeted #注释掉
SELINUX=disabled #增加
:wq 保存,关闭
shutdown -r now #重启系统
yum install wget #安装下载工具wget
wget http://www.atomicorp.com/installers/atomic #下载atomic yum源
sh ./atomic #安装
yum check-update #更新yum软件包
#############################################################################
安装:
yum -y install nginx #安装nginx,
service nginx start #启动
chkconfig nginx on #设为开机启动
/etc/init.d/nginx restart #重启
1、安装mysql
/etc/init.d/mysqld start #启动MySQL
chkconfig mysqld on #设为开机启动
cp /usr/share/mysql/my-medium.cnf /etc/my.cnf #拷贝配置文件(注意:如果/etc目录下面默认有一个my.cnf,直接覆盖即可)
reboot #重启系统
mysql_secure_installation
回车,根据提示输入Y
输入2次密码,回车
根据提示一路输入Y
最后出现:Thanks for using MySQL!
/etc/init.d/mysqld stop #停止
/etc/init.d/mysqld start #启动
service mysqld restart #重启
1、安装PHP
yum -y install php
2、安装PHP组件,使PHP支持 MySQL、PHP支持FastCGI模式
yum -y install php-mysql php-gd libjpeg* php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-bcmath php-mhash libmcrypt libmcrypt-devel php-fpm
/etc/init.d/mysqld restart #重启MySql
/etc/init.d/nginx restart #重启nginx
/etc/rc.d/init.d/php-fpm start #启动php-fpm
chkconfig php-fpm on #设置开机启动
#############################################################################
配置
cp /etc/nginx/nginx.conf /etc/nginx/nginx.confbak #备份原有配置文件
vi /etc/nginx/nginx.conf #编辑
user nginx nginx; #修改nginx运行账号为:nginx组的nginx用户
:wq! #保存退出
vi /etc/nginx/conf.d/default.conf #编辑
# 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 $document_root$fastcgi_script_name;
include fastcgi_params;
}
#取消FastCGI server部分location的注释,并要注意fastcgi_param行的参数,改为$document_root$fastcgi_script_name,或者使用绝对路径
#在386行 列出PHP可以禁用的函数,如果某些程序需要用到这个函数,可以删除,取消禁用。
expose_php = Off #在432行 禁止显示php版本的信息
magic_quotes_gpc = On #在745行 打开magic_quotes_gpc来防止SQL注入
open_basedir = .:/tmp/ #在380行,设置表示允许访问当前目录(即PHP脚本文件所在之目录)和/tmp/目录,可以防止php木马跨站,如果改了之后安装程序有问题,可注销此行,或者直接写上程序目录路径/var/www/html/www.osyunwei.com/:/tmp/
:wq! #保存退出
vi /etc/php-fpm.d/www.conf #编辑
user = nginx #修改用户为nginx
group = nginx #修改组为nginx
/etc/init.d/nginx restart #重启nginx
/etc/rc.d/init.d/php-fpm restart #重启php-fpm
#############################################################################
测试
cd /usr/share/nginx/html/ #进入nginx默认网站根目录
vi index.php #新建index.php文件
phpinfo();
?>
:wq! #保存
#############################################################################