第一次配置LAMP运行环境,上网查询了很多资料,一边试命令一边学习。服务器重置了很多次。

虽然有OneinStack这个方便的网站一键命令部署,但知道这个网站却是我自己踩坑之后的事情了,故此记录。

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

CentOS6.8 LAMP的更多相关文章

  1. CentOS6编译LAMP基于FPM模式的应用wordpress

    CentOS6编译LAMP基于FPM模式的应用wordpress 引言:其实我们可以直接使用yum安装LAMP(Linux+Apache[httpd]+Mysql+PHP),比手动编译安装LAMP要简 ...

  2. centos6.5 lamp 环境 使用yum安装方法

    从网上找了一些 最后整理了下 1.安装Apache yum -y install httpd # 开机自启动 chkconfig httpd on # 启动httpd 服务 service httpd ...

  3. centos6 安装 lamp

    首先更新一下yum -y update 安装Apache yum install httpd httpd-devel 安装完成后,用/etc/init.d/httpd start 启动apache 设 ...

  4. CentOS6.4 LAMP环境搭建

    网上的教程,不能按着抄打进去,这样会打乱你环境放置位置, 会导致配置路径会出问题. 要有一个环境目录优化, 把环境文件都装在/usr/local里面 首先,把安装文件rar都放置在/usr/local ...

  5. centos6安装lamp

    1.安装Apache [root@localhost ~]# yum -y install httpd 设置开启自启动 [root@localhost ~]# chkconfig httpd on 启 ...

  6. CentOS6 安装Sendmail + Dovecot + Roundcubemail

    前言 本文是继CentOS6 安装Sendmail + Dovecot + Squirrelmail 关于邮箱服务器配置的第二篇文章,因为关于使用Sendmail进行相关配置的文章.资料等太老,而且资 ...

  7. Ubuntu --- 【转】安装lamp(php7.0)

    本篇转自:http://www.laozuo.org/8303.html.以防丢失,再次记录 PHP7已经出来有一段时间,根据网友的实践测试比之前的版本效率会高不少,而且应用到网站中打开速度会有明显的 ...

  8. centos lamp笔记

    cron and crontab are missing in docker image of ubuntu 16.04 在鏡像中沒有 cron 命令 How to install php-redis ...

  9. 搭建hustoj

    环境:centos6.5 + LAMP环境 LAMP环境的搭建可以参考下面这篇文章 http://www.cnblogs.com/yoke/p/7257184.html 搭建完LAMP环境之后可以按照 ...

随机推荐

  1. MySQL 数据库中如何把A表的数据插入到B表?

    web开发中,我们经常需要将一个表的数据插入到另外一个表,有时还需要指定导入字段,设置只需要导入目标表中不存在的记录,虽然这些都可以在程序中拆分成简单sql来实现,但是用一个sql的话,会节省大量代码 ...

  2. DIRECTORY_SEPARATOR 与 getcwd

    DIRECTORY_SEPARATOR:目录分隔符,linux上就是’/’    windows上是’\’ ,php的内置常量是一个显示系统分隔符的命令,php的内部常量,不需要任何定义与包含即可直接 ...

  3. H3C IP地址拒绝及释放

  4. 2019-6-5-WPF-隐藏系统窗口菜单

    title author date CreateTime categories WPF 隐藏系统窗口菜单 lindexi 2019-06-05 17:26:44 +0800 2019-06-05 17 ...

  5. H3C VLSM

  6. eclipse中maven报错--Dmaven.multiModuleProjectDirectory system propery is not set. Check $M2_HOME environment variable and mvn script match.

    -Dmaven.multiModuleProjectDirectory system propery is not set. Check $M2_HOME environment variable a ...

  7. 【58.33%】【codeforces 747B】Mammoth's Genome Decoding

    time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...

  8. jq 技巧汇总

    1,jQuery方法$()实际上是拥有两个参数的 $('li','.firstEl').onclick(function(){.......})   这里,第二个参数用来限制第一个参数给定的查找结果 ...

  9. vue 实例未加载完成显示 花括号解决方案

    css [v - cloak] { display: none!important; } html < div id = "app" v-cloak >

  10. 洛谷——P1305 新二叉树(新建二叉树以及遍历)

    题目描述输入一串二叉树,用遍历前序打出. 输入输出格式输入格式: 第一行为二叉树的节点数n.(n \leq 26n≤26) 后面n行,每一个字母为节点,后两个字母分别为其左右儿子. 空节点用*表示 输 ...