怎样在linux下安装和开始APACHE 和httpd服务
Q. How do I install and start the Apache or httpd web server under Fedora core or Cent OS?
A. Apache HTTP Server is a free software/open source web server for Unix-like systems and other oses.
Apache features configurable error messages, DBMS-based authentication databases, and content negotiation. It is also supported by several graphical user interfaces (GUIs) which permit easier, more intuitive configuration of the server.
Use rpm command to install Apache under Linux. You can also use up2date or yum command to install the same.
Task: Install Apache/httpd under Fedroa Core/Cent OS Linux
Type the following command if you are using Fedora or Cent OS Linux:
# yum install httpd
Now, start the Apache/httpd
# chkconfig httpd on
# /etc/init.d/httpd start
Task: Install Apache/httpd under Red Hat Enterprise Linux
Type the following command
# up2date httpd
Start the Apache/httpd
# chkconfig httpd on
# /etc/init.d/httpd start
Task: Debian Linux httpd/Apache installation
Use apt-get command:
# apt-get install apache2
# /etc/init.d/apache2 start
Task: Verify that port 80 is open
# netstat -tulpn | grep :80
You can also install httpd from CDROM with rpm command:
# rpm -ivh httpd*
Configuration
Your server is started but you need to configure and use Apache as per your requirement. /etc/httpd/conf/httpd.conf (RHEL/Cent OS/Fedora Core Linux) or /etc/apache2/httpd.conf (Debian / Ubuntu Linux) configuration file. Use text editor such as vi to edit file. This file is very well documented or read official Apache configuration documentation for more information.
1. 下载apache, https://httpd.apache.org/download.cgi 通过这个官方网站,我们可以下到最新的版本。现在版本都是以这样的方式表达的:httpd-*.*.*.tar.gz
2. 例如,你现在去官网下载的就是最新版本:httpd-2.2.9.tar.gz。
3. 好了,下载到你的家目录/root里面。
4. [root@hostlocal~]# ls // 你会看到你下载的httpd-2.2.9.tar.gz.
5. [root@hostlocal~]# tar –zxvf httpd-2.2.9.tar.gz // 解压后为httpd-2.2.9
6. [root@hostlocal~]# mkdir –p /usr/local/web/apache/ //在这个目录下建立文档,利于管理
7. [root@hostlocal~]# mv /root/httpd-2.2.9 /usr/local/src/ //将安装包放到/src下,利于管理
8. [root@hostlocal~]# cd httpd-2.2.9
9. [root@httpd-2.2.9]#./configure –prefix=/usr/local/web/apache \ //安装路径
? –enable-shared=max \
? –enable-module=rewirte \
? –enable-module=so
10. [root@httpd-2.2.9]# make //编译
11. [root@httpd-2.2.9]# make install
12. [root@hostlocal~]# service httpd start //开启httpd服务
安装成功后,apache将会安装到/usr/local/web/apache下面。然后在windows主机的IE中输入apache服务器的IP地址。看是否可以访问到。
» 本文来自:彭攀 » 《怎样在linux下安装和开始APACHE 和httpd服务》最后更新:2017-01-04 22:34:51