当前位置: 首页 > Linux

CentOS6.8LAMP

时间:2023-04-06 05:21:23 Linux

1安装Apacheyum-yinstallhttpd#设置启动chkconfig--listhttpd查看chkconfighttpdon#进入配置文件修改如下vi/etc/httpd/conf/httpd.confServerNamelocalhost:80DirectoryIndexindex.htmlindex.phpindex.htmservicehttpdrestart2安装MySQLwgethttps://repo.mysql.com//mysql57-community-release-el6-9.noarch.rpmrpmmysql57-community-release-el6-9.noarch.rpmyum安装mysql-community-serverservicemysqldstart#mysql临时密码存放位置:/var/log/mysqld.logchkconfigmysqldonmysql-uroot-psetpasswordforusername@localhost=password('newpassword');3安装PHP#安装依赖包rpm-Uvhhttps://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpmrpm-Uvhhttps://mirror.webtatic.com/yum/el6/latest.rpm#安装PHP及相关软件yuminstallphp70w.x86_64php70w-opcache.x86_64php70w-pdo.x86_64php70w-fpm.x86_64php70w-mysql.x86_64yum安装php70w-gd.x86_64libjpeg*php70w-ldap.x86_64php70w-odbc.x86_64php70w-pear.x86_64安装php70w-pear.x86_64libjpeg*xmlrpc.x86_64php70w-mbstring.x86_64php70w-bcmath.x86_64php-mhashphp70w-pecl-redis.x86_64#查看php-fpmwhereisphp-fpm#启动php-fpmservicephp-fpmstart#查看php版本php-v4配置SSH#配置系统自带的SSH,修改Port22端口number/etc/ssh/sshd_config#重启SSH服务servicesshdrestart5安装phpMyAdmin#跳转到站点根目录cd/var/www/html#下载压缩包wgethttps://files.phpmyadmin.net/phpMyAdmin/4.6.0/phpMyAdmin-4.6.0-all-languages.tar.gz#解压tarzxvfphpMyAdmin-4.6.0-all-languages.tar.gz#重命名mvphpMyAdmin-4.6.0-all-languages.tar.gznewNameservicemysqldrestart#如果提示缺少mysqli文件vi/etc/php.d/mysqli.ini#取消";Enablemysqliextensionmodule"前的分号#查看安装的软件,如rpm-qa|grepmysql*6Apache配置301重定向#打开Apache配置文件vi/etc/httpd/conf/httpd.conf#去掉“#LoadModulerewrite_modulemodules/mod_rewrite.so”前面的“#”#添加#Open301RewriteRewriteEngineon#LoglevelRewriteLogLevel0在httpd.conf文件末尾#Log地址RewriteLoglogs/rewrite.log#maincoderewritecond%{HTTP_HOST}^straystarry.com$rewriterule^(.+)%{HTTP_HOST}$1[C]rewriterule^straystarry.com(.*)https://www.straystarry.com$1