1 安装Apache
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
2 安装MySQL
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('新密码');
3 安装PHP
# 安装依赖包
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
4 配置SSH
# 配置系统自带的SSH,修改Port 22端口号
/etc/ssh/sshd_config
# 重启SSH服务
service sshd restart
5 安装phpMyAdmin
# 跳转到站点根目录
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*
6 Apache配置301重定向
# 打开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
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。