免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1292 | 回复: 0
打印 上一主题 下一主题

Install Apache2 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2005-01-12 16:26 |只看该作者 |倒序浏览
Install Apache2


                                                                         Updated: 11/17/2004

General Information

Installing a web serving application is usually one of the most essential things on a FreeBSD server.  In this short tutorial, I shall explain the basics of installing and configuring Apache 2.0.52 (will also work with previous builds of Apache 2.x but you should be using the latest version).

Requirements

Root access to the server
Internet access
Compilation tools
Installation

First, let's download and untar Apache 2.0.52!

#wget http://ftp.plig.net/pub/apache/dist/httpd/httpd-2.0.52.tar.gz

#  tar zxvf httpd-2.0.52.tar.gz

Now that Apache has been extracted, let's change to its directory.

#  cd httpd-2.0.52

Now we'll create a unique group and user for Apache to run under.  This can be useful when browsing logs, or even for security.

#pw group add websrv
#pw user add websrv -g websrv -s /sbin/nologin - d /usr/local/apache  


Now that we've created Apache's group and user, let's configure it with DSO support.  We'll also include the --with-php and --with-mysql switches just in case you want to install them later on.

#  ./configure --prefix=/usr/local/apache --enable-mods-shared=all --enable-so --with-php --with-mysql

After that's run through its boring process of making sure you have everything Apache needs in the right place, we'll compile the sources.

#  make

And now that's done, we should install the compiled binaries and other files.

#  make install

Now we need to make sure that the Apache libraries are installed, to do this, we'll add a line to our ld.so.conf file.

#  echo "/usr/local/apache/modules" >;>; /etc/ld.so.conf

As we've done that, we'll have to create a cache and links for the shared libraries.

#  ldconfig

Wahey! Apache is installed, but, before we can fire the beast up, we need to do a little configuring.  Don't worry, it's not hard.

Configuration

First, we'll make Apache recognize other types of document other than .html.

#  pico /usr/local/apache/conf/httpd.conf

Now hold CTRL+W to bring up Pico's where feature, and type "AddType".  Add the following lines:

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps  

Now hold CTRL+W again to bring up the where feature again, and type "DirectoryIndex".  This is where we set the files that the server should look for in a directory before displaying everything in that directory (the index file).  In this example, index.php will be shown first, however if that doesn't exist, index.html will be shown.

DirectoryIndex index.php index.html  

Find the User and Group directives and change whatever you have there to:

User websrv
Group websrv  

Double check your changes, save and quit.  Now that we've finished our configuration, we should change the ownership of Apache to the websrv group and user that we created.

#  chown -R websrv:websrv /usr/local/apache

And now we'll start Apache.

#  /usr/local/apache/bin/apachectl start

That's all! Have fun web serving.

This guide is & 2004 bsdresource.org.

Author: configure
configure at bsdresource dot org


Comments

StealthNinja on October 11, 2004 at 8:52:43 am MST
Whats wrong with the
# cd /usr/ports/www/apache2
# make install clean

or if you need to tune any options then
# make show-options
before you do the
# make install clean


嘿嘿,不错,随时英文,但也是傻瓜教程。
队新手朋友肯定有用。哈哈,
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP