PHP,mysql,nginxunx中安装
发布时间:2020-12-13 16:06:53 所属栏目:PHP教程 来源:网络整理
导读:一:安装PHP,mysql,nginx 1 linux装软件方式: 2 1.源码安装:下载wget--》解压tar -zxvf --》配置 ./configure --- 》编译make 3 -- 安装 make install 4 2. yum安装 一键安装包 centos 红帽 乌班图 5 3. rpm 6 7 l n m p 8 9 linux 版本 39.98.47.141 10 w
一:安装PHP,mysql,nginx 1 linux装软件方式: 2 1.源码安装:下载wget--》解压tar -zxvf --》配置 ./configure ---》编译make 3 -->安装 make install 4 2.yum安装 一键安装包 centos 红帽 乌班图 5 3.rpm 6 7 l n m p 8 9 linux 版本 39.98.47.141 10 windows 11 12 centos 6.5 6.8 system nekwrok restart 13 centos 7.0+ systemctl 14 15 centos 7.4 7.5 16 17 systemctl status firewalld.service 查看防火墙 18 systemctl stop firewalld.service 19 systemctl disable firewalld.service 开机 防火墙 不自启 20 21 ###Nginx#######安装篇############ 22 rpm -ivh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm 23 yum list nginx ##查询更新列表 24 yum -y install nginx ##yum安装命令 25 26 systemctl start nginx.service ##开启nginx服务软件 27 systemctl enable nginx.service ##加入开启启动项 28 29 ###Nginx#######测试篇###################### 30 用windows浏览器 测试 31 http://39.98.47.141/(阿里云IP) 32 看到: 33 Welcome to nginx! 34 表示: 35 Nginx安装成功了 36 问题1: 访问不了 37 阿里云: 安全组 --》配置 --》 克隆一个 端口 80 38 ########################################### 39 40 ===========================================接》》着》》安装》》PHP》》=================================================》》》》 41 42 43 ###Php56#######安装篇############ 44 rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm 45 rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm 46 47 yum -y install php56w php56w-fpm php56w-opcache php56w-mysql php56w-gd libjpeg* php56w-ldap php56w-odbc php56w-pear php56w-xml php56w-xmlrpc php56w-mbstring php56w-bcmath 48 49 systemctl start php-fpm.service ## 启动 php-fpm 软件 用于 运行PHP脚本 50 systemctl enable php-fpm.service ## 加入 php-fpm 开启自动项 51 52 /etc/nginx/conf.d/ 目录下: 虚拟机配置文件 53 54 nginx.conf 55 include 56 57 vim /etc/nginx/conf.d/default.conf 58 59 :set nu #####开启行数 60 ###将30行-36行 前面 # 去掉 61 ###将 第31行 "html" 改成 /usr/share/nginx/html 62 ###将 第34行 "/scripts" 改成 $document_root 63 64 location ~ .php$ { 65 root /usr/share/nginx/html; 66 fastcgi_pass 127.0.0.1:9000; 67 fastcgi_index index.php; 68 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 69 include fastcgi_params; 70 } 71 72 :wq! ##退出保存 73 74 systemctl restart nginx.service 75 systemctl restart php-fpm.service 76 77 vim /usr/share/nginx/html/index.php 78 ###编辑如下代码 测试环境脚本 79 <?php 80 echo phpinfo(); 81 ?> 82 83 84 ###Nginx关联php脚本#######测试篇###################### 85 用windows浏览器 测试 86 http://39.107.105.231/index.php (阿里云IP) 87 看到: 88 PHP Version 5.6.36 89 表示: 90 Nginx关联php成功了,也就是PHP安装成功了! 91 ##################################################### 92 93 ===========================================接》》着》》安装》》MySQL》》=================================================》》》》 94 95 ###Mysql#######安装篇############ 96 rpm -qa|grep mariadb #查看阿里云默认安装的mariadb数据库 版本号:如:mariadb-libs-5.5.56-2.el7.x86_64 97 rpm -e --nodeps mariadb-libs-5.5.56-2.el7.x86_64 ##卸载mariadb-libs-5.5.56-2.el7.x86_64包 (rpm -e --nodeps 后面跟是上个命令查询结果) 98 99 rpm -e --nodeps mariadb-libs-5.5.44-2.el7.centos.x86_64 100 101 102 rpm -ivh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm 103 yum list mysql-community-server 104 yum -y install mysql-community-server 105 106 systemctl start mysqld.service 107 systemctl enable mysqld.service 108 109 mysql_secure_installation ###初始化 mysql系统数据(安装系统数据库) 110 111 ##提示: Enter current password for root (enter for none): 112 空密码,回车 113 114 ##提示: Set root password? [Y/n] 115 y,回车 116 117 ##提示: New password: 118 输入数据库密码,如:zha123456 (两次重复密码) 119 120 ##提示: Remove anonymous users? [Y/n] 121 y,回车 122 123 ##提示: Disallow root login remotely? [Y/n] 124 y,回车 125 126 ##提示: Remove test database and access to it? [Y/n] 127 y,回车 128 129 ##提示: Reload privilege tables now? [Y/n] 130 y,回车 131 132 ###提示: 看到: 133 Thanks for using MySQL! 134 135 136 mysql -h localhost -u root -p 137 Enter password:******** rootroot 138 139 mysql> 140 mysql>GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘zha123456‘ WITH GRANT OPTION; ##开启mysql远程访问权限 141 mysql>flush privileges; ##刷新权限 142 mysql>exit; 143 144 systemctl stop firewalld.service 145 146 ###MySQL#######测试篇###################### 147 ###提示: 阿里云 安全组 克隆规则 148 允许 自定义 TCP 3306/3306 地址段访问 0.0.0.0/0 System created rule. 149 用Navicat for MySQL 新建连接测试 150 表示: 151 Navicat for MySQL 连接阿里云Ip数据库, 152 外网访问正常,ok!! 153 ##################################################### 154 155 ===========================================接》》着》》安装》》Iwebshop》》=================================================》》》》 156 157 上传iwebshop压缩包: 158 FileZilla: 159 160 unzip iwebshop.zip 161 162 vim /etc/selinux/config (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |