安装php7相应的yum源 CentOS 7.x: # rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm # rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm CentOS 6.x: # rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm 查看版本 yum search php7 安装php7 # yum install mod_php71w php71w-opcache php71w-fpm 安装php7扩展: # yum install php71w-gd php71w-mbstring # yum install php71w php71w-bcmath php71w-cli php71w-common php71w-devel php71w-fpm php71w-gd php71w-mbstring php71w-mcrypt php71w-pdo php71w-pear php71w-pecl-* php71w-process php71w-xm* 安装nginx yum install nginx 安装mysql wget https://dev.mysql.com/get/mysql80-community-release-el7-2.noarch.rpm rpm -Uvh mysql80-community-release-el7-2.noarch.rpm yum repolist all | grep mysql vim /etc/yum.repos.d/mysql-community.repo yum repolist enabled | grep mysql yum install mysql-community-server service mysqld start mysql 修改密码 mysql> use mysql; mysql> UPDATE user SET Password = PASSWORD('newpass') WHERE user = 'root'; mysql> FLUSH PRIVILEGES; liunx新增用户 useradd admin groupadd admin passwd admin contos7端口开启 firewall-cmd --query-port=8083/tcp firewall-cmd --zone=public --add-port=80/tcp --permanent firewall-cmd --reload systemctl start firewalld systemctl stop firewalld systemctl status firewalld contos6端口开启 yum -y install iptables-services vi /etc/sysconfig/iptables systemctl restart iptables.service #重启防火墙使配置生效
防火墙永久开启80端口
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --zone=public --add-port=8080/tcp --permanent
重启防火墙
systemctl restart firewalld.service
状态
systemctl status firewalld.service
暂时关闭
systemctl stop firewalld.service
永久关闭
systemctl disable firewalld.service
查看用户组
cat /etc/group
cat /etc/passwd
删除用户
groupdel admin
userdel admin
nginx配置虚拟主机目录不生效原因
4.1、查看当前selinux的状态。
1. /usr/sbin/sestatus
4.2、将SELINUX=enforcing 修改为 SELINUX=disabled 状态。
1. vi /etc/selinux/config
3. #SELINUX=enforcing
4. SELINUX=disabled
4.3、重启生效。reboot。