标签:重启 nlp 密码 关闭防火墙 php info chm share iptable
CentOS-6 最小化系统部署lnmp环境
一:准备工作
yum install -y vim
yum install -y wget
yum 阿里源
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
编写 nginx.repo 文件
cat>>/etc/yum.repos.d/nginx.repo<<EOF
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/6/$basearch/
gpgcheck=0
enabled=1
EOF
关闭防火墙和selinux
sed -i ‘s#SELINUX=enforcing#SELINUX=disabled#g‘ /etc/sysconfig/selinux
service iptables stop
二:安装 nginx
yum install -y nginx
service nginx start
netstat -tunlp|grep 80
ps -ef | grep nginx
创建 php 测试文件
vim /usr/share/nginx/html/index.php
<?php
phpinfo();
?>
三:安装 php
yum install php-cli php-fpm
yum install -y php-*
service php-fpm start
netstat -tunlp|grep 9000
修改vim /etc/nginx/conf.d/default.conf参数
location / {
root /usr/share/nginx/html;
index index.php index.html index.htm;
}
location ~ \.php$ {
root /usr/share/nginx/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;
}
service nginx restart
service nginx reload
修改php-fpm配置文件
php-fpm配置文件位置:(vim /etc/php-fpm.d/www.conf)
修改
user =nginx
group=nginx
可以把 php-fpm、nginx 放到开机自启中
chkconfig php-fpm on
chkconfig nginx on
四:安装 mydql
yum install mysql mysql-server
service mysqld start
netstat -tunlp|grep 3306
创建 mysql 密码
#mysql即可进入mysql
mysql> use mysql;
mysql> update user set password=password("123456") where user="root";
mysql> flush privileges;
mysql> quit
以下把自己的 php 项目放到根目录下就可以
cd /usr/share/nginx/html/
cd ..
chmod -R 777 html
如果报数据库的错库,可以重启虚拟机试试看
init 6
service iptables stop
service mysqld start
标签:重启 nlp 密码 关闭防火墙 php info chm share iptable
原文地址:http://blog.51cto.com/12384628/2151037