第一次配置LAMP运行环境,上网查询了不少资料,一边试命令一边学习。服务器重置了不少次。php
虽然有OneinStack这个方便的网站一键命令部署,但知道这个网站倒是我本身踩坑以后的事情了,故此记录。html
yum -y install httpd # 设置开机启动chkconfig --list httpd查看 chkconfig httpd on # 进入配置文件进行以下修改 vi /etc/httpd/conf/httpd.conf ServerName localhost:80 DirectoryIndexindex.html index.php index.htm service httpd restart
wget https://repo.mysql.com//mysql57-community-release-el6-9.noarch.rpm rpm mysql57-community-release-el6-9.noarch.rpm yum install mysql-community-server service mysqld start # mysql临时密码保存位置:/var/log/mysqld.log chkconfig mysqld on mysql -uroot -p set password for 用户名@localhost = password('新密码');
# 安装依赖包 rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm # 安装PHP及相关软件 yum install php70w.x86_64 php70w-opcache.x86_64 php70w-pdo.x86_64 php70w-fpm.x86_64 php70w-mysql.x86_64 yum install php70w-gd.x86_64 libjpeg* php70w-ldap.x86_64 php70w-odbc.x86_64 php70w-pear.noarch php70w-xml.x86_64 yum install php70w-xmlrpc.x86_64 php70w-mbstring.x86_64 php70w-bcmath.x86_64 php-mhash php70w-pecl-redis.x86_64 # 查看php-fpm whereis php-fpm # 启动php-fpm service php-fpm start # 查看php版本 php -v
# 配置系统自带的SSH,修改Port 22端口号 /etc/ssh/sshd_config # 重启SSH服务 service sshd restart
# 跳转到站点根目录 cd /var/www/html # 下载压缩包 wget https://files.phpmyadmin.net/phpMyAdmin/4.6.0/phpMyAdmin-4.6.0-all-languages.tar.gz # 解压 tar zxvf phpMyAdmin-4.6.0-all-languages.tar.gz # 重命名 mv phpMyAdmin-4.6.0-all-languages.tar.gz newName service mysqld restart # 若提示丢失mysqli文件 vi /etc/php.d/mysqli.ini # 取消掉“;Enable mysqli extension module”前的分号 # 查看已安装软件,如 rpm -qa | grep mysql*
# 打开Apache配置文件 vi /etc/httpd/conf/httpd.conf # 去掉“#LoadModule rewrite_module modules/mod_rewrite.so”前面的“#” # 在httpd.conf文件最后加上 #Open 301Rewrite RewriteEngine on #Log level RewriteLogLevel 0 #Log address RewriteLog logs/rewrite.log #main code rewritecond %{HTTP_HOST} ^straystarry.com$ rewriterule ^(.+) %{HTTP_HOST}$1 [C] rewriterule ^straystarry.com(.*) https://www.straystarry.com$1