分类: LINUX
2009-03-21 10:11:51
Apache
首先说明一下我的安装环境,
Linux是
交叉编译环境是 arm-linux-gcc 2.95.3(arm-linux-gcc –v查看此信息),若版本过高,apache会不支持,会出现 /lib/libc.so
在移植的时候是参照网上一位博客的移植记录上,并在其基础上修改的。感谢这位朋友。
1. 在软件包,若存到/home/yuaf/Web/apache目录下,
2. 解压 tar zxvf Apache
3. 进入到 apache
4. 返回到 apache
5. 用交叉编译环境编译。需要重新建立一个目录,如在 /home/yuaf/Web/arm目录下。然后通过 cp 命令把软件包拷贝到该目录下,解压 tar zxvf apache
6. 进入到 ../src/目录下,执行
export CC=”arm-linux-gcc”
.之后在该目录下执行 ./Configure 生成Makefile文件,在这过程中,会出现错误,如:
/home/yuaf/Web/arm/apache_
/home/yuaf/Web/arm/apache_
/home/yuaf/Web/arm/apache_
/home/yuaf/Web/arm/apache_
/home/yuaf/Web/arm/apache_
7. 把在主机上用gcc编译过的生成的(/home/yuaf/Web/apache/.. ../src/main目录下) 两个可执行文件gen_test_char 和 gen_uri_delims. 覆盖用arm-linux-gcc编译过的,在目录
/home/yuaf/Web/arm/.. ../src/main下的两个文件。
8. 在/home/yuaf/Web/arm/apach
export CC=”arm-linux-gcc”
然后 ./configure 一下,之后就是用make 命令编译整个文件,之后就是用命令
Make install 安装此服务器了。最后提示你
+--------------------------------------------------------+
| You now have successfully built and installed the |
| Apache 1.3 HTTP server. To verify that Apache actually |
| works correctly you now should first check the |
| (initially created or preserved) configuration files |
| |
| /usr/local/apache/conf/httpd.conf
| |
| and then you should be able to immediately fire up |
| Apache the first time by running: |
| |
| /usr/local/apache/bin/apachectl start
| |
| Thanks for using Apache. The Apache Group |
| |
+--------------------------------------------------------+
服务安装成功。可能在执行安装的时候,你的权限不够,得用根用户,在ubuntu下,用sudo命令获得根用户权限就行了。因为此服务程序安装在/usr/local目录下的。
9. 把在 /usr/local/下生成的目录 apache拷贝到你的nfs根文件系统的 /nfs_root/usr/local/ 目录下。
10. 修改配置http.conf文件。在/nfs_root/usr/local/apache/conf/ 目录下,用文本编辑器打开。
还有注意的是,apache拒绝使用root用户运行。所以你需要增加一个用户和用户组,我们可以使用 http.conf配置文件默认的用户名和用户组名,nobody和nobody。具体来说就是在ARM Linux根文件系统上建立/etc/passwd和/etc/group两个文件,它们的内容可以如下:
/etc/passwd
root::0:0:root:/:/bin/ash
nobody::65534:65533:nobody:/:/bin/ash
/etc/group
nobody::65533:
nogroup::65534:nobody
root::0:
users::100
如果rootfs中有这两个文件,那么就只需要检查一下是不是有nobody用户和nogroup组。
关于http.conf的配置见其最后。
11.配置完之后,你就可以启动服务器了。
#httpd
然后你就可以在你的浏览器下面输入你的开发板 IP地址,这样你就可以看见一个测试网页了。
配置http.conf, http.conf里面的内容是:
Conf/httpd.conf
ServerType standalone
ServerRoot "/usr/local/apache"
PidFile /usr/local/apache/logs/httpd.pid
ScoreBoardFile /usr/local/apache/logs/httpd.scoreboard
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15
MinSpareServers 5
MaxSpareServers 10
StartServers 5
MaxClients 150
MaxRequestsPerChild 0
Listen
Port 80
User nobody
Group nobody
ServerAdmin
ServerName
DocumentRoot "/usr/local/apache "
Options FollowSymLinks
AllowOverride None
UserDir public_html
DirectoryIndex index.htm
AccessFileName .htaccess
Order allow,deny
Deny from all
Satisfy All
UseCanonicalName On
TypesConfig /usr/local/apache/conf/mime.types
DefaultType text/plain
MIMEMagicFile /usr/local/apache/conf/magic
HostnameLookups Off
ErrorLog /usr/local/apache/logs/error_log
LogLevel warn
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
CustomLog /usr/local/apache/logs/access_log common
ServerSignature On
Alias /icons/ "/usr/local/apache/icons/"
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
Alias /manual/ "/usr/local/apache/htdocs/manual/"
Options Indexes FollowSymlinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
ScriptAlias /cgi-bin/ "/usr/local/apache/cgi-bin/"
AllowOverride None
Options None
Order allow,deny
Allow from all
IndexOptions FancyIndexing
AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip
AddIconByType (TXT,/icons/text.gif) text/*
AddIconByType (IMG,/icons/image2.gif) image/*
AddIconByType (SND,/icons/sound2.gif) audio/*
AddIconByType (VID,/icons/movie.gif) video/*
AddIcon /icons/binary.gif .bin .exe
AddIcon /icons/binhex.gif .hqx
AddIcon /icons/tar.gif .tar
AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv
AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip
AddIcon /icons/a.gif .ps .ai .eps
AddIcon /icons/layout.gif .html .shtml .htm .pdf
AddIcon /icons/text.gif .txt
AddIcon /icons/c.gif .c
AddIcon /icons/p.gif .pl .py
AddIcon /icons/f.gif .for
AddIcon /icons/dvi.gif .dvi
AddIcon /icons/uuencoded.gif .uu
AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl
AddIcon /icons/tex.gif .tex
AddIcon /icons/bomb.gif core
AddIcon /icons/back.gif ..
AddIcon /icons/hand.right.gif README
AddIcon /icons/folder.gif ^^DIRECTORY^^
AddIcon /icons/blank.gif ^^BLANKICON^^
DefaultIcon /icons/unknown.gif
ReadmeName README.html
HeaderName HEADER.html
IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t
AddLanguage da .dk
AddLanguage nl .nl
AddLanguage en .en
AddLanguage et .ee
AddLanguage fr .fr
AddLanguage de .de
AddLanguage el .el
AddLanguage he .he
AddCharset ISO-8859-8 .iso8859-8
AddLanguage it .it
AddLanguage ja .ja
AddCharset ISO-2022-JP .jis
AddLanguage kr .kr
AddCharset ISO-2022-KR .iso-kr
AddLanguage nn .nn
AddLanguage no .no
AddLanguage pl .po
AddCharset ISO-8859-2 .iso-pl
AddLanguage pt .pt
AddLanguage pt-br .pt-br
AddLanguage ltz .lu
AddLanguage ca .ca
AddLanguage es .es
AddLanguage sv .sv
AddLanguage cs .cz .cs
AddLanguage ru .ru
AddLanguage zh-TW .zh-tw
AddCharset Big5 .Big5 .big5
AddCharset WINDOWS-1251 .cp-1251
AddCharset CP866 .cp866
AddCharset ISO-8859-5 .iso-ru
AddCharset KOI8-R .koi8-r
AddCharset UCS-2 .ucs2
AddCharset UCS-4 .ucs4
AddCharset UTF-8 .utf8
LanguagePriority en da nl et fr de el it ja kr no pl pt pt-br ru ltz ca es sv tw
AddType application/x-tar .tgz
AddEncoding x-compress .Z
AddEncoding x-gzip .gz .tgz
BrowserMatch "Mozilla/2" nokeepalive
BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0
BrowserMatch "RealPlayer 4\.0" force-response-1.0
BrowserMatch "Java/1\.0" force-response-1.0
BrowserMatch "JDK/1\.0" force-response-1.0
其实也就是我上面颜色地方的显示的注意一下就可以了,其它的就选用默认的就行了。