当前位置: 首页 > Linux

CentOS7安装Nginx1.18+MySQL5.6.50+PHP5.6.40

时间:2023-04-07 01:40:57 Linux

CentOS7rpm安装Nginx1。更改计算机名hostnamectlset-hostnamefangjun-host2。下载nginxrpm安装文件wgethttp://nginx.org/packages/centos/7/x86_64/RPMS/nginx-1.18.0-2.el7.ngx.x86_64.rpm3。安装rpm-ivhnginx-1.18.0-2.el7.ngx.x86_64.rpm4。设置启动,开机启动//启动systemctlstartnginx.service//设置开机自启动:systemctlenablenginx.service//查看当前服务状态systemctlstatusnginx.service//关闭防火墙systemctlstopfirewalld.service//停止防火墙systemctldisablefirewalld.service//禁止防火墙启动systemctllist-units--type=service//查看所有启动的服务5.Nginx配置phpserver{listen80;服务器名称本地主机;根/www/视频;#putoutsideindexindex.php;字符集utf-8;error_log/www/video/nginx.error.log错误;access_log/www/video/nginx.access.logmain;位置~\.php${fastcgi_pass127.0.0.1:9000;fastcgi_indexindex.php;fastcgi_split_path_info^(.+\.php)(.*)$;#打开path_infofastcgi_paramPATH_INFO$fastcgi_path_info;#Openpath_infofastcgi_paramSCRIPT_FILENAME$document_root$fastcgi_script_name;包括fastcgi_params;}#打开伪静态#try_files$uri$uri//index.php$is_args$cm/cinluxtstring;c#.conf;}CentOS7,yum下安装MySQL5.6.501。查看是否已经安装1.rpm-qa|grepmysql如果安装了老版本的Mysql,卸载即可。2、卸载命令:卸载前先关闭mysql服务rpm-ev--nodepsmysql-community-release-el7-x.noarchrpm-ev--nodepsmysql-community-common-5.x.38-2.el7。x86_64rpm-ev--nodepsmysql-community-client-5。x.38-2.el7.x86_64rpm-ev--nodepsmysql-community-libs-5.x.38-2.el7.x86_64rpm-ev--nodepscommunity-server-5.x.38-2。el7.x86_642.AddReposource//下载wgethttp://repo.mysql.com/yum/mysql-5.6-community/el/7/x86_64/mysql-community-release-el7-5.noarch.rpm//安装源rpm-Uvhmysql-community-release-el7-5.noarch.rpm3。查看当前可安装版本yumrepolistall|grepmysql//如果显示启用了MySql5.6,则跳过第4步mysql56-community/x86_64MySQL5.6CommunityServerenabled:5644.修改安装版本//关闭5.7版并安装yum-config-manager--disablemysql57-community//开启5.6版并安装yum-config-manager--enablemysql56-无法执行communityyum-config-manager。这是因为系统默认没有安装这个命令。该命令在yum-utils包中,可以通过命令yum-yinstallyum-utils安装5.验证版本yumrepolistall|grepmysql//或启用yumrepolist|grepmysql查看当前启用的mysql版本,如果是你设置的版本,就可以安装了。6、安装MySQL5.6//如果提示参数错误:yummoduledisablemysqlyuminstallmysql-community-server7。启动MySQLsystemctlstartmysqld.service8。启动systemctlenablemysqld.service9。启用MySQL安全设置为'root'@'localhost'=PASSWORD('12345')设置密码;10、验证MySQL是否安装成功mysql-uroot-p12345修改远程登录:GRANTALLPRIVILEGESON*.*TO'root'@'%'IDENTIFIEDBY'12345'WITHGRANTOPTION;刷新:FLUSHPRIVILEGES;11、配置my.inivi/etc/my.cnfCentos7yuminstallphp5.61。查看当前安装的PHP包yumlistinstalled|grepphp2.如果有已安装的PHP包,先将其删除他们yumremovephp.x86_64php-cli.x86_64php-common.x86_64php-gd.x86_64php-ldap.x86_64php-mbstring.x86_64php-mcrypt。x86_64php-mysql.x86_64php-pdo.x86_643.配置yum源//以下是CentOS7.0的源。yum安装epel-releaserpm-ivhhttp://rpms.famillecollet.com/enterprise/remi-release-7.rpm4。使用yumlist命令查看可安装的软件包(Packege)。yumlist--enablerepo=remi--enablerepo=remi-php56|grepphp5.安装PHP5.6.xyuminstall--enablerepo=remi--enablerepo=remi-php56phpphp-opcachephp-mbstringphp-mysqlndphp-pdophp-fpmphp-gd6.可选性安装插件php56-php.x86_645.6.40-23.el7.remiphp56-php-bcmath.x86_645.6.40-23.el7.remiphp56-php-brotli.x86_640.11.1-1.el7.remiphp56-php-channel-horde.noarch1.0-2.el7.remiremiphp56-php-cli.x86_645.6.40-23.el7.remiremiphp56-php-common.x86_645.6.40-23.el7.remiremiphp56-php-dba.x86_645.6.40-23.el7.remiphp56-php-dbg.x86_645.6.40-23.el7.remiphp56-php-devel.x86_645.6.40-23.el7.remiphp56-php-embedded.x86_645.6.40-23.el7.remiremiphp56-php-enchant.x86_645.6.40-23.el7.remiremiphp56-php-fpm.x86_645.6.40-23.el7.remiremiphp56-php-gd。x86_645.6.40-23.el7.remiremiphp56-php-geos.x86_641.0.0-2.el7.remiremiphp56-php-gmp.x86_645.6.40-23.el7.remiremiphp56-php-horde-horde-lz4.x86_641.0.10-15.el7.remiremiphp56-php-imap.x86_645.6.40-23.el7.remiremiphp56-php-interbase.x86_645.6.40-23.el7.remiremiphp56-php-intl.x86_645.6.40-23.el7.remiphp56-php-ioncube-loader.x86_6410.4.4-1.el7.remiphp56-php-ldap.x86_645.6.40-23.el7.remi雷米php56-php-libvirt.x86_640.5.5-1.el7.remiremiphp56-php-libvirt-doc.noarch0.5.5-1.el7.remiremiphp56-php-litespeed.x86_645.6.40-23.el7.remiremiphp56-php-lz4.x86_640.4.0-1.el7.remiphp56-php-magickwand.x86_641.0.9.2-18.el7.remiphp56-php-maxminddb.x86_641.6.0-1.el7.remiphp56-php-mbstring.x86_645.6.40-23.el7.remiremiphp56-php-mcrypt.x86_645.6.40-23.el7.remiremiphp56-php-mssql.x86_645.6.40-23.el7.remiremiphp56-php-mysqlnd.x86_64//命令yuminstall--enablerepo=remi--enablerepo=remi-php56php-fpm7.启动php服务systemctlstartphp-fpm8.设置php服务开机自动启动systemctlenablephp-fpm