Install Apache2 On Debian

来自开放百科 - 灰狐
(版本间的差异)
跳转到: 导航, 搜索
(配置Java)
(配置Java)
第92行: 第92行:
 
  可能出现的问题:configure: error: C++ preprocessor "/lib/cpp" fails sanity check
 
  可能出现的问题:configure: error: C++ preprocessor "/lib/cpp" fails sanity check
 
  解决方法:apt-get install build-essential
 
  解决方法:apt-get install build-essential
 +
make
 +
cp apache-2.0/mod_jk.so /usr/local/apache2/modules/
  
 
*参考: [http://hi.baidu.com/toicine/blog/item/3785ed31154c0a1aebc4af00.html 整合apache2,tomcat.架构web简单服务器]
 
*参考: [http://hi.baidu.com/toicine/blog/item/3785ed31154c0a1aebc4af00.html 整合apache2,tomcat.架构web简单服务器]

2012年2月22日 (三) 05:47的版本

寻找安装包

#apt-cache search apache2 

目录

快速安装

#apt-get insall apache2
#apt-get install libapache2-mod-php4 or libapache2-mod-php5
#apt-get install libapache2-mod-python2.3
#apt-get install apt-get install ruby1.8 ruby1.8-examples
#ruby1.8 -version// ruby version info
#apt-get install libapache2-mod-ruby libfcgi-ruby1.8 libfcgi-dev
#apt-get install libapache2-mod-perl2
#apt-get install mysql-server-4.1 mysql-client-4.1
#apt-get install php4-mysql or php5-mysql
#apt-get install python2.3-mysqldb
#apt-get libdbd-mysql-ruby1.8 // Ruby/DBI MySQL driver for Ruby 1.8
#apt-get install libdbd-mysql-perl // A Perl5 database interface to the MySQL database
#apt-get install postgresql // install postgresql 7.4.7
#apt-get install php4-pgsql // PostgreSQL module for php4
#apt-get install python2.3-pygresql // PostgreSQL module for Python
#apt-get install python2.3-pgsql // A Python DB-API 2.0 interface to PostgreSQL v7.x
#apt-get install libdbd-pg-ruby1.8 // Ruby/DBI PostgreSQL driver for Ruby 1.8
#apt-get install libpg-perl // Perl modules for PostgreSQL

修改Apache2

vi /etc/apache2/sites-enabled/000-default
#RedirectMatch ^/$ /apache2-default/

配置PHP

把PHP脚本放在 /var/www 目录下就可以支持运行啦。

编译源码

apt-get install bison // 不安装会出现运行apache时,产生错误:不能加载libphp5.so:undefined symbol: zend_parse_parameters 
./configure --prefix=/usr/local/php5 --disable-libxml --disable-xml --disable-dom --disable-simplexml --disable-xmlreader --disable-xmlwriter 
--with-apxs2=/usr/local/apache2/bin/apxs --disable-cli
重新编译需运行下 make distclean

配置Python

vi /etc/apache2/sites-enabled/000-default, 加入以下内容

<Directory /var/www/python/>
   SetHandler mod_python
   PythonHandler mod_python.publisher
</Directory>
 

创建index.py文件

def index(name):
 return "Welcome %s" % name   
http://localhost/python/?name=huihoo (OK :)

配置Perl

vi /etc/apache2/sites-enabled/000-default, 加入以下内容

 Alias /perl/ /var/www/perl/
 <Location /perl/>
     SetHandler perl-script
     PerlResponseHandler ModPerl::Registry
     PerlOptions +ParseHeaders
     Options +ExecCGI
     Order allow,deny
     Allow from all 
 </Location>

touch index.pl

#!/usr/bin/perl
print "Content-type: text/plain\n\n";
print "mod_perl \n";
http://localhost/perl/index.pl (OK :)

配置Ruby

ruby在apache里是以cgi或是fastcgi的形式运行的。

vi /etc/apache2/sites-enabled/000-default, 加入以下内容

Alias /ruby/ "/var/www/ruby/"
<Location /ruby/>
   Options ExecCGI
   AddHandler cgi-script .cgi
   AddHandler fastcgi-script .fcgi .fcg .fpl
   AllowOverride all
   Order allow,deny
   Allow from all
</Location>

touch index.fcgi

#!/usr/bin/ruby1.8
print "Content-type: text/plain\n\n";
print "ruby \n";

配置Java

apt-get install libapache2-mod-jk
获得jk包 http://www.apache.org/dist/tomcat/tomcat-connectors/jk/
./configure --with-apxs=/usr/local/apache2/bin/apxs
可能出现的问题:configure: error: C++ preprocessor "/lib/cpp" fails sanity check
解决方法:apt-get install build-essential
make 
cp apache-2.0/mod_jk.so /usr/local/apache2/modules/

参考

分享您的观点
个人工具
名字空间

变换
操作
导航
工具箱