本站由以下要素构成
1.域名 外网可正常访问和指向
2.空间 外网可正常访问和指向
3.域名绑定空间做指针指向

原文参考:
http://www.linuxidc.com/Linux/2014-07/104563.htm
架构 LAMP CNETOS

1、安装Apache
[[email protected] ~]# yum -y install httpd

开机自启动

[[email protected] ~]# chkconfig httpd on

启动httpd 服务

[[email protected] ~]# service httpd start

安装 SSL 建议此步骤在安装mysql完成后进行

[email protected] ~]# yum -y install httpd-manual mod_ssl mod_perl mod_auth_mysql

2、安装配置MySQL

mysql 客户端程序

mysql-server服务端程序

mysql-devel开发设计的库

[[email protected] ~]# yum -y install mysql mysql-server mysql-devel

开机启动

[[email protected] ~]# chkconfig mysqld on

启动mysqld服务

[[email protected] ~]# service mysqld start

进行一些安全性配置

[[email protected] ~]# /usr/bin/mysql_secure_installation

检查是否成功

[[email protected] ~]# netstat -tulpn | grep -i mysql

tcp0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 1723/mysqld

OK, 我们看到mysqld已经启动,监听在3306端口上。

3.安装 PHP
安装相关模块:为了让PHP支持MySQL,我们可以安装php-mysql软件包;

[[email protected] ~]# yum -y install php php-mysql

安装php常用扩展

[[email protected] ~]# yum search php

搜索可用的php模块

[[email protected] ~]# yum -y install gd php-gd gd-devel php-xml php-common php-mbstring php-ldap php-pear php-xmlrpc php-imap

其他PHP模块

[[email protected] ~]# yum -y php-需要模块名称

PHP7只需要安装一下即安装以上
yum install php70w-common php70w-fpm php70w-opcache php70w-gd php70w-mysqlnd php70w-mbstring php70w-pecl-redis php70w-pecl-memcached php70w-devel

安装之前先同步源
http://blog.csdn.net/dxywx/article/details/50609137

CentOS/RHEL 7.x:

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
CentOS/RHEL 6.x:

rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
Now you can install PHP 7.0 (along with an opcode cache) by doing:

yum install php70w php70w-opcache

重启httpd服务,这一步很重要

[[email protected] ~]# service httpd restart

这里可以下探针查看服务器配置
http://www.yahei.net/
http://down.chinaz.com/server/201206/1994_1.htm
或者
vi命令建一个phpinfo

[[email protected] ~]# cd /var/www/html/
[[email protected] html]# vi index.php

PHPINFO请百度

iptables没设置错,不出意外,在浏览器键入http://域名 或 http://IP

应该会看到测试页面

剩下的如果PHP扩展没安装安装Mcrypt
方案1.
查询命令
原文参考:
http://www.cnblogs.com/ccdc/archive/2013/04/19/3030156.html
原文参考:
http://www.yiweihy.com/knowledge/develop/176-centos-yum-mcrypt.html
1.安装如下更新
epel-release-6-5.noarch.rpm

[[email protected] ~]# rpm -ivh epel-release-6-7.noarch.rpm

yum update 更新系统

[[email protected] ~]# yum update

2.查看是否已经有了 EPEL(Extra Packages for Enterprise Linux) 扩展包

[[email protected] ~]# yum repolist

3.执行命令:

安装mcrypt扩展包

[[email protected] ~]yum install php-mcrypt

重启apache使扩展生效

[[email protected] ~]# service httpd restart

方案2
原文参考:
http://www.blogjava.net/nkjava/archive/2015/01/20/422289.html
Centos下Yum安装PHP5.5,5.6,7.0
默认的版本太低了,手动安装有一些麻烦,想采用Yum安装的可以使用下面的方案:
1.检查当前安装的PHP包

[[email protected] ~]yum list installed | grep php

如果有安装的PHP包,先删除他们

[[email protected] ~]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

2.
Centos 5.X

[[email protected] ~]rpm -Uvh http://mirror.webtatic.com/yum/el5/latest.rpm

CentOs 6.x

[[email protected] ~]rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm

CentOs 7.X
[[email protected] ~]rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
[[email protected] ~]rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

如果想删除上面安装的包,重新安装
rpm -qa | grep webstatic
rpm -e 上面搜索到的包即可

3.运行

[[email protected] ~]yum install php55w.x86_64 php55w-cli.x86_64 php55w-common.x86_64 php55w-gd.x86_64 php55w-ldap.x86_64 php55w-mbstring.x86_64 php55w-mcrypt.x86_64 php55w-mysql.x86_64 php55w-pdo.x86_64

[[email protected] ~]yum install php56w.x86_64 php56w-cli.x86_64 php56w-common.x86_64 php56w-gd.x86_64 php56w-ldap.x86_64 php56w-mbstring.x86_64 php56w-mcrypt.x86_64 php56w-mysql.x86_64 php56w-pdo.x86_64

注:如果想升级到5.6把上面的55w换成56w就可以了。

[[email protected] ~]yum install php70w.x86_64 php70w-cli.x86_64 php70w-common.x86_64 php70w-gd.x86_64 php70w-ldap.x86_64 php70w-mbstring.x86_64 php70w-mcrypt.x86_64 php70w-mysql.x86_64 php70w-pdo.x86_64

4.安装PHP FPM
[[email protected] ~]yum install php55w-fpm
[[email protected] ~]yum install php56w-fpm
[[email protected] ~]yum install php70w-fpm

注:如果想升级到5.6把上面的55w换成56w就可以了。

4.上传需要的网页程序
执行并安装,如此BOLG程序

标签: none

添加新评论