帮你搭建自己lamp平台

运维 系统运维
用过LAMP的人们都知道,LAMP是由 Linux+Apache+Mysql+Perl/PHP/Python 一起组成的,LAMP的搭建工作是学好和使用LAMP工具的前提条件,我带领大家过一遍LAMP的搭建过程!

 

[[20314]] 

图-LAMP

搭建属于自己的LAMP平台,就要亲自动手做一遍!

  2.1安装apache_1.3.41

  软件获取:http://httpd.apache.org/

  安装步骤:

  tar xvfz apache_1.3.14.tar.gz

  cd apache_1.3.41

  修改src/include/httpd.h 增大最大线程数,将:

  #define HARD_SERVER_LIMIT 256

  改成:

  #define HARD_SERVER_LIMIT 2048

  保存退出

  ./configure \

  –prefix=/usr/local/apache \

  –enable-module=so \

  –enable-module=rewrite \

  –enable-shared=max \

  –htdocsdir=/var/www

  make

  make install

  启动:

  /usr/local/apache/bin/apachectl start

  说明:

  –prefix=/usr/local/apache说明安装路径

#p#

  2.2安装httpd-2.2.11

  软件获取:http://httpd.apache.org/

  安装步骤:

  tar xvfz httpd-2.2.11.tar.gz

  cd httpd-2.2.11

  ./configure –prefix=/usr/local/apache2 \

  –sysconfdir=/etc/httpd \

  –enable-ssl \(如果configure报错,不加这句也可。)

  –enable-modules

  make

  make install

  vim /etc/httpd/httpd.conf

  将#ServerName www.exapmle.com:80这一行替换为:

  ServerName localhost:80

  把httpd加入到系统服务中:

  cp /usr/local/apache2/bin/apachectl /etc/init.d/httpd

  chmod 755 /etc/init.d/ httpd

  之后可执行service httpd start或service httpd restart或service httpd stop来启动或停止Apathe2服务。

  启动及停止:

  /usr/local/apache2/bin/apachectl –k start

  netstat -tnl 可以看到80端口,说明apache启动了。

  ifconfig查看Linux服务器ip地址:

  inet addr:127.0.0.1

  用浏览器查看http:// 127.0.0.1/index.html得到it works!说明apache已经配置成功了。

  或,用浏览器查看http://localhost/index.html得到it works!说明apache已经配置成功了。

  /usr/local/apache2/bin/apachectl -k stop

  /usr/local/apache2/bin/apachectl –k restart

  若想开机时自动启动apache服务器,在/etc/rc.local的exit 0前加入

  /usr/local/apache2/bin/apachectl –k start

  若不想运行/etc/rc.local,只要chmod –x /etc/rc.local即可。

  说明:

  –prefix=/usr/local/apache2说明安装路径,以后要删除安装就只需删除这个目录。

  –sysconfdir=/etc/httpd说明主配置文件httpd.conf位置

  –enable-ssl支持网页加密

  –enable-modules支持模块

  手动安装的网站默认目录在/usr/local/apache2/htdocs,由/etc/httpd/httpd.conf中的DocumentRoot “/usr/local/apache2/htdocs”一行说明。

  配置:

  vim /etc/httpd/httpd.conf

  将ServerAdmin you@example.com一行改为自己的常用邮箱。

  DocumentRoot “/usr/local/apache2/htdocs”一行说明了网站的默认目

通过文章的里面的安装和配置过程,想必大家多少都学会了些,那就赶快动手吧!

【编辑推荐】

 

责任编辑:赵鹏 来源: 网络转载
相关推荐

2011-03-21 16:08:24

LAMP

2011-03-22 09:42:04

lamp

2011-03-09 13:02:31

LAMP环境搭建

2011-03-14 13:06:58

LAMP搭建

2011-03-10 10:08:19

DebianLAMP

2011-04-02 11:40:17

LAMP测试环境

2011-03-09 13:03:15

Centos搭建LAMP

2011-03-18 10:06:48

LAMP组成

2011-03-10 10:09:09

UbuntuLAMP搭建

2011-03-09 15:44:14

UbuntuLAMP

2011-03-10 14:40:48

LAMP搭建

2011-03-23 10:13:53

LAMP环境搭建

2022-04-18 10:36:48

社交软件聊天平台rocket.cha

2011-03-21 10:36:42

LAMPLAMP搭建

2011-03-21 11:33:09

LAMPApache

2011-01-14 12:02:50

Linux影音

2011-03-21 11:43:45

LAMPPHP

2011-03-22 10:17:22

LAMP

2011-03-23 13:27:32

LAMP

2011-03-22 14:12:17

LAMP
点赞
收藏

51CTO技术栈公众号