732
中電雲集
怎樣在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