幫你搭建自己lamp平臺
圖-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 增大最大線程數(shù),將:
#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加入到系統(tǒng)服務(wù)中:
cp /usr/local/apache2/bin/apachectl /etc/init.d/httpd
chmod 755 /etc/init.d/ httpd
之后可執(zhí)行service httpd start或service httpd restart或service httpd stop來啟動或停止Apathe2服務(wù)。
啟動及停止:
/usr/local/apache2/bin/apachectl –k start
netstat -tnl 可以看到80端口,說明apache啟動了。
ifconfig查看Linux服務(wù)器ip地址:
inet addr:127.0.0.1
用瀏覽器查看http:// 127.0.0.1/index.html得到it works!說明apache已經(jīng)配置成功了。
或,用瀏覽器查看http://localhost/index.html得到it works!說明apache已經(jīng)配置成功了。
/usr/local/apache2/bin/apachectl -k stop
/usr/local/apache2/bin/apachectl –k restart
若想開機時自動啟動apache服務(wù)器,在/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支持網(wǎng)頁加密
–enable-modules支持模塊
手動安裝的網(wǎng)站默認(rèn)目錄在/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”一行說明了網(wǎng)站的默認(rèn)目
通過文章的里面的安裝和配置過程,想必大家多少都學(xué)會了些,那就趕快動手吧!
【編輯推薦】
- lamp平臺搭建的總結(jié)
- Ubuntu 一條命令安裝LAMP
- LAMP應(yīng)用程序調(diào)優(yōu)的5種方法
- 用apt-get搭建LAMP環(huán)境
- RedHat9 下 LAMP 環(huán)境的架設(shè)記錄
- ubuntu10.04下安裝LAMP