lamp

本节所讲内容:

[if !supportLists]• [endif]实战:搭建LAMP环境及快速部署双网站并实现基于域名的虚拟主机


LAMP架构:???

Linux+Apache+Mysql+PHP

Linux+Apache+Mysql/MariaDB+Perl/PHP/Python一组常用来搭建动态网站或者服务器的开源软件共同组成了一个强大的Web应用程序平台.


一、安装需要的软件包

[root@xuegod63 ~]# yum install httpd mysql-server mysql php php-mysql  -y

httpd # web服务器

mysql-server  #mysql数据库

mysql  # mysql服务器linux下客户端

php  #php相关文件

php-mysql   #这个包的作用是什么???


查看php-mysql包作用:-qpi:列出RPM软件包的描述信息

root@xuegod63 Packages]# rpm -pqi php-mysql-5.3.3-3.el6_1.3.x86_64.rpm

warning: php-mysql-5.3.3-3.el6_1.3.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY

Name        : php-mysql                    Relocations: (not relocatable)

Version     : 5.3.3                             Vendor: Red Hat, Inc.

Release     : 3.el6_1.3                     Build Date: Mon 24 Oct 2011 08:41:54 PM CST

Install Date: (not installed)               Build Host: x86-004.build.bos.redhat.com

Group       : Development/Languages         Source RPM: php-5.3.3-3.el6_1.3.src.rpm

Size        : 220619                           License: PHP

Signature   : RSA/8, Wed 02 Nov 2011 09:58:41 PM CST, Key ID 199e2f91fd431d51

Packager    : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>

URL         : http://www.php.net/

Summary     : A module for PHP applications that use MySQL databases  #php程序连接mysql使用的模块


启动服务LAMP相关服务:

启动apche:

[root@xuegod63 ~]# service httpd start

Starting httpd:                                            [  OK  ]

[root@xuegod63 ~]# chkconfig httpd on


[root@xuegod63 ~]# service mysqld start

[root@xuegod63 ~]# chkconfig mysqld on


测试数据库连接:

连接mysql数据库,连接本机可以去掉-h

#mysql

或:

# mysql -h IP -u USER -pPASS

mysql的超级管理员是root,root用户拥有最mysql数据库的最高权限。

例:

# mysql -u root

mysql> exit;    #退出mysql  ,mysql每条命令后都加一个分号 ; 结束。

配置root密码:    mysql

例1:配置root密码

[root@xuegod64 ~]# /usr/bin/mysqladmin -u root password "123456"

mysql> exit   #退出命令可以加分号,也可以不加分号。

Bye


测试网站是否支持PHP

# cd /var/www/html/

[root@stu003 html]# vim index.php

[root@stu003 html]# cat  index.php

<?php

phpinfo();

?>

测试:

http://192.168.1.63/index.php


LAMP环境搭建完成


二、安装ecshop网站步骤:

[if !supportLists]1、 [endif]解压

[if !supportLists]2、 [endif]上传

[if !supportLists]3、 [endif]修改权限

[if !supportLists]4、 [endif]在页面进行安装


上传网站模板ECShop_V2.7.3_UTF8_release0411.zip

[root@xuegod63 ~]# unzip  ECShop_V2.7.3_UTF8_release0411.zip

[root@xuegod63 ~]# cd  ECShop_V2.7.3_UTF8_release0411/

[root@xuegod63 ECShop_V2.7.3_UTF8_release0411]# ls

docs  upgrade  upload

上传upload   mv  upload/  /var/www/html/ecshop



修改权限

chown apache:apache ecshop/ -R


网页安装:

http://www.xuegodcd.cn/ecshop/install/



数据库名可以自定义

登录密码大于8位,数字字母组合


安装时报错:

创建配置文件............成功创建数据库............成功安装数据............成功创建管理员帐号............失败

Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Chongqing' for 'CST/8.0/no DST' instead in /home/babap/ecshop/includes/lib_time.php on line 28 OK


修改方法

vim ecshop/install/includes/init.php

1<?php


2 date_default_timezone_set ('Asia/Shanghai');第二行插入此代码,设置时区


改完后关闭报错窗口,再次点击立即安装



删除install



登录后台:(管理中心)

http://www.xuegodcd.cn/ecshop/admin/privilege.php?act=login

cd/xuegod123


三、Discuz论坛安装步骤:

[if !supportLists]1、 [endif]解压

[if !supportLists]2、 [endif]上传

[if !supportLists]3、 [endif]修改权限

4、在页面进行安装

[root@xuegod64 ~]# unzip Discuz_X3.2_SC_UTF8.zip


[root@xuegod64 ~]# mv upload/ /var/www/html/discuz


修改文件名

[root@xuegod64 discuz]# cd config/

[root@xuegod64 config]# ls

config_global_default.php  config_ucenter_default.php  index.htm

[root@xuegod64 config]# cp config_global_default.php config_global.php

[root@xuegod64 config]# cp config_ucenter_default.php config_ucenter.php


修改权限

[root@xuegod64 discuz]# chown apache.apache config/ data/ -R

[root@xuegod64 discuz]# chown apache.apache uc_client/ uc_server/ -R

在页面安装:

http://192.168.10.64/discuz/install/







可以注册来玩一玩



四、设置基于域名的虚拟主机

vim /etc/httpd/conf/httpd.conf  添加两个基于域名的虚拟主机。

990行,改:

#NameVirtualHost *:80

为:

NameVirtualHost *:80


在文件末尾

<VirtualHost *:80>

    ServerAdmin webmaster@dummy-host.example.com

    DocumentRoot /var/www/html/kaixin001

    ServerName uc.xuegod63.cn

    ErrorLog logs/dummy-host.example.com-error_log

    CustomLog logs/dummy-host.example.com-access_log common

</VirtualHost>

<VirtualHost *:80>

    ServerAdmin webmaster@dummy-host.example.com

    DocumentRoot /var/www/html/kaixin

    ServerName www.xuegod63.cn

    ErrorLog logs/dummy-host.example.com-error_log

    CustomLog logs/dummy-host.example.com-access_log common

</VirtualHost>


启动服务:

service httpd restart


内网ip,我想用域名的方式访问???

修改hosts

C:\Windows\System32\drivers\etc\hosts

域名ip地址

域名ip地址


总结:

[if !supportLists]1、 [endif]搭建LAMP环境

[if !supportLists]2、 [endif]快速搭建ecshop

[if !supportLists]3、 [endif]快速搭建discuz论坛

[if !supportLists]4、 [endif]配置apache基于域名的虚拟主机

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • 1.LAMP介绍  LAM(M)P:L: linuxA: apache (httpd)M: mysql, mar...
    尛尛大尹阅读 1,269评论 0 1
  • 一、LAMP环境的介绍 1.LAMP环境的重要性 思索许久,最终还是决定写一篇详细的LAMP的源码编译安装的实验文...
    endmoon阅读 2,946评论 4 26
  • 1、确认搭建LAMP所需的环境是否已经安装: [root@localhost ~]#rpm -q make gcc...
    4e855d444c9f阅读 563评论 0 0
  • 1、讲述httpd工作原理以rpm包的方式安装LAMP,配置基于域名的虚拟机主机并部署PhpMyAdmin、Wor...
    stephe_c阅读 727评论 0 1
  • 1 概述 LAMP 目前在CentOS6不支持php-fpm的安装,安装高版本的数据库在centos6上也需要通过...
    ghbsunny阅读 555评论 0 0

友情链接更多精彩内容