centos6 linux服务器配置+apache+php5.6+mysql+压缩软件

apache安装

检查是否安装过 apache 命令:httpd -v
安装命令: yum -y install httpd
安装成功显示 Complete !

启动

systemctl start httpd.service 

停止

systemctl stop httpd.service 

重启

systemctl restart httpd.service 

每次上传文件、修改文件要重启 httpd
开机启动 systemctl enable httpd.service
开机不启动 systemctl disable httpd.service

打开网页,查看是否有 testing 页面,有即为安装成功

php安装

删除旧 php

yum remove php.x86_64 php-cli.x86_64 php-common.x86_64 php-gd.x86_64 php-ldap.x86_64 php-mbstring.x86_64 php-mcrypt.x86_64 php-mysql.x86_64 php-pdo.x86_64 

配置 epel

yum install -y epel-release 
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo 

配置 remi

rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm 

安装 php5.6.x

yum install --enablerepo=remi --enablerepo=remi-php56 php php-opcache php-devel php-mbstring php-mcrypt php-mysqlnd php-phpunit-PHPUnit php-pecl-xdebug php-pecl-xhprof 

安装 php-fpm

yum install --enablerepo=remi --enablerepo=remi-php56 php-fpm 

安装 gd

 yum --enablerepo=remi-php56 install php-gd php-mysql php-mbstring php-xml php-mcrypt

配置开机启动服务

systemctl restart php-fpm 
systemctl enable php-frm 

查看是否安装成功

ps -ef | grep php 
netstat -anp | grep 9000 

Mysql安装

wget http://repo.mysql.com/mysql57-community-release-el7-10.noarch.rpm
rpm -Uvh mysql57-community-release-el7-10.noarch.rpm

安装 mysql 服务端:

yum install -y mysql-community-server

安装完成启动

mysql:systemctl start mysqld.service

修改密码:
查看临时密码:

grep 'temporary password' /var/log/mysqld.log

使用默认的密码登陆:

mysql -u root -p

修改密码:

ALTER USER 'root'@'localhost' IDENTIFIED BY 'root123';//(最好复杂点)

授权其他机器登陆:

GRANT ALL PRIVILEGES ON*.*TO'root'@'%'IDENTIFIEDBY' 密码 'WITH GRANT OPTION

启动 mysql

systemctl start mysqld.service

安装解压软件

yum install -y unzip zip

配置站点

把项目放到 /home/www/ 文件夹内,然后在 /etc/httpd/site/ 文件夹内新建 index.conf 文件,里面配置以下内容:

<VirtualHost *:80>
    DocumentRoot  "/home/www/文件名 "
    ServerName 域名
    ServerAlias 域名
   <Directory "/home/www/文件名">
      Options +Includes -Indexes
      AllowOverride All
      Order allow,deny
      Allow from all
     </Directory>
</VirtualHost>

/home/httpd/conf/ 下的 httpd.conf 文件中更改 119 行以及 131 行的地址,在最后添加 IncludeOptional site/*.conf; 然后在 etc/httpd/ 文件夹内创建 site 文件夹
重启 apache :

systemctl restart httpd.service 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值