日期:2014-05-16  浏览次数:20814 次

Ubuntu下apache安装方式

apt安装apache

sudo apt-get install apache2

使用apt命令,简单快速安装apache服务器

编译安装apache

在http://httpd.apache.org/download.cgi下载最新安装源文件,本人下载的版本为httpd-2.4.7.tar.gz,移动到/var/opt/目录下,解压文件

sudo tar -zxvf httpd-2.4.7.tar.gz

cd httpd-2.4.7

sudo ./configure --prefix=/usr/local/apache --enable-so --enable-modules=all --enable-mods-shared=all

sudo make

sudo make install

自此Apache已经安装完成,启动Apache

sudo /usr/local/apache2/bin/apachectl start

打开浏览器,并在地址栏中输入主机的IP地址
如http://Localhost/

如出现it works,表明正确安装,

使apache自启动

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

sudo chmod 775 apachectl

sudo chkcongfig apachectl on

使用apache的基本了命令:

apache start 启动apache

apache restart 重启apache

apache stop 停止apache