我们专注攀枝花网站设计 攀枝花网站制作 攀枝花网站建设
成都网站建设公司服务热线:400-028-6601

网站建设知识

十年网站开发经验 + 多家企业客户 + 靠谱的建站团队

量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决

linux(apache2.2/2.4+tomcat6/7+php)

apache+tomcat整合的理解: 网站一般分为前台和后台,前台的页面放到一个目录里比如:web。后台的程序放到一个目录里:admin。 apache虚拟主机的文档根目录指向tomcat的项目目录,这个目录下有2个目录:root,admin root下面存放这网站的所有前台页面,admin里面存放这所有的后台程序。 所需要的软件: wgethttp://mirror.esocc.com/apache/tomcat/tomcat-7/v7.0.52/bin/apache-tomcat-7.0.52.tar.gz wgethttp://lnamp-web-server.googlecode.com/files/httpd-2.2.21.tar.gz wgethttp://archive.apache.org/dist/tomcat/tomcat-connectors/jk/tomcat-connectors-1.2.32-src.tar.gz wgethttp://oracleotn.rd.llnwd.net/otn-pub/java/jdk/6u26-b03/jdk-6u26-linux-i586-rpm.bin (1)配置DNS [root@nan87/]#vim/etc/named.conf zone"."IN{ typehint; file"named.ca"; }; zone"dog.com"IN{ typemaster; file"named.dog.com"; }; [root@nan87/]#vim/var/named/named.dog.com $TTL600 @INSOAdog.com.root(20140304011H15M1W1D); @INNSdog.com. dog.com.INA10.10.54.87

陵城网站制作公司哪家好,找创新互联!从网页设计、网站建设、微信开发、APP开发、成都响应式网站建设公司等网站项目制作,到程序开发,运营维护。创新互联从2013年创立到现在10年的时间,我们拥有了丰富的建站经验和运维经验,来保证我们的工作的顺利进行。专注于网站建设就选创新互联

www.dog.com.INA10.10.54.87 bbs.dog.com.INA10.10.54.87 hr.dog.com.INA10.10.54.87 (2)安装apache [root@nan87softs]#tarxvfhttpd-2.2.21.tar.gz [root@nan87softs]#cdhttpd-2.2.21 [root@nan87httpd-2.2.21]#./configure--prefix=/usr/local/apache--enable-modules=most--enable-mods-shared=all--enable-so--with-included-apr [root@nan87httpd-2.2.21]#make [root@nan87httpd-2.2.21]#makeinstall //把apache的bin目录加入到PATH变量中去,在文件加入一下面的行,这样就可以直接使用apachectlstart/stop/restart [root@nan87httpd-2.2.21]#vim/etc/profile exportPATH=$PATH:/usr/local/apache/bin [root@nan87httpd-2.2.21]#source/etc/profile //或者把/usr/local/apache/bin/apachectl启动文件放到/etc/init.d下 [root@nan87httpd-2.2.21]#cp/usr/local/apache/bin/apachectl/etc/init.d/httpd [root@nan87httpd-2.2.21]#vim/usr/local/apache/conf/httpd.conf ServerNamewww.dog.com:80 [root@nan87httpd-2.2.21]#/etc/init.d/httpdrestart (3)安装JDK环境 JDK下载 x64代表64位 http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html tomcat运行环境下,JDK是必不可少的软件,因为tomcat是一个Servlet/JSP容器,底层的操作都需要JDK来完成。 [root@nan87softs]#rpm-ivhjdk-7u51-linux-x64.rpm //查看jdk的安装路径 [root@nan87softs]#rpm-qa|grepjdk jdk-1.7.0_51-fcs.x86_64 [root@nan87softs]#rpm-qljdk-1.7.0_51-fcs.x86_64 安装在/usr/java下 //查看版本 [root@nan87softs]#java-version javaversion"1.7.0_51" Java(TM)SERuntimeEnvironment(build1.7.0_51-b13) JavaHotSpot(TM)64-BitServerVM(build24.51-b03,mixedmode) (4)安装PHP 安装libmcrypt,如果不安装编译时会出错 [root@nan87softs]#tarxvflibmcrypt-2.5.7.tar.gz [root@nan87libmcrypt-2.5.7]#cdlibmcrypt-2.5.7 [root@nan87libmcrypt-2.5.7]#mkdir-p/usr/local/libmcrypt --libmcrypt的安装目录 [root@nan87libmcrypt-2.5.7]#./configureprefix=/usr/local/libmcrypt/ [root@nan87libmcrypt-2.5.7]#make [root@nan87libmcrypt-2.5.7]#makeinstall //正式安装PHP [root@nan87softs]#tarxvfphp-5.4.25.tar.gz [root@nan87softs]#cdphp-5.4.25 ./configure--prefix=/usr/local/php--with-apxs2=/usr/local/apache/bin/apxs--with-config-file-path=/usr/local/php/etc--with-mysql=/usr/local/mysql--with-mysqli=/usr/local/mysql/bin/mysql_config--with-iconv-dir--with-jpeg-dir--with-png-dir--with-zlib--with-libxml-dir--enable-xml--disable-rpath--enable-bcmath--enable-shmop--enable-sysvsem--enable-inline-optimization--with-curl--with-curlwrappers--enable-mbregex--enable-fpm--enable-mbstring--with-mcrypt--with-gd--with-freetype-dir--enable-gd-native-ttf--with-openssl--with-mhash--enable-pcntl--enable-sockets--with-ldap--with-ldap-sasl--with-xmlrpc--enable-zip--enable-soap--enable-session--with-gettext--with-mcrypt=/usr/local/libmcrypt 注意一下这些的地址: --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 出现错误及解决方法如下: configure:error:xml2-confignotfound.Pleasecheckyourlibxml2installation. [root@nan87php-5.4.25]#yuminstalllibxml2-devel.x86_64 configure:error:Pleasereinstallthelibcurldistribution- easy.hshouldbein/include/curl/sss [root@nan87php-5.4.25]#yuminstalllibcurl-devel.x86_64 configure:error:jpeglib.hnotfound. [root@nan87php-5.4.25]#yuminstalllibjpeg-turbo-devel.x86_64 configure:error:png.hnotfound. [root@nan87php-5.4.25]#yuminstalllibpng-devel.x86_64 configure:error:freetype-confignotfound. [root@nan87php-5.4.25]#yuminstallfreetype-devel.x86_64 configure:error:Cannotfindldap.h [root@nan87php-5.4.25]#yuminstallopenldap-devel.x86_64 configure:error:Cannotfindldaplibrariesin/usr/lib. [root@nan87php-5.4.25]#cp-frp/usr/lib64/libldap*/usr/lib/ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 接着编译 [root@nan87php-5.4.25]#make ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 出现错误: 找不到libmysqlclient.so.18 softs/php-5.4.25/sapi/cli/php:errorwhileloadingsharedlibraries:libmysqlclient.so.18:cannotopensharedobjectfile:Nosuchfileordirectory make:***[ext/phar/phar.php]Error127 解决方法: --建立软链接 [root@nan87lib]#ln-s/usr/local/mysql/lib/libmysqlclient.so.18/usr/lib [root@nan87lib]#ldconfig ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [root@nan87php-5.4.25]#makeclean [root@nan87php-5.4.25]#make [root@nan87php-5.4.25]#maketest [root@nan87php-5.4.25]#makeinstall ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 出现错误: --2014-03-0921:24:55--http://pear.php.net/install-pear-nozlib.phar Resolvingpear.php.net...failed:Nameorservicenotknown. wget:unabletoresolvehostaddress“pear.php.net” make:***[install-pear]Error4 解决方法: [root@nan87php-5.4.25]#cp/softs/go-pear.php/softs/php-5.4.25/pear/install-pear-nozlib.phar ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ makeclean 再makeinstall (5)修改apache配置文件,让apache支持php [root@nan87~]#vim/usr/local/apache/conf/httpd.conf LoadModulephp5_modulemodules/libphp5.so --看到上面一句表明apache现在已经集成了对php的支持,不过目前,apache还不“认识”.php扩展名的文件,如果通过浏览器请求.php扩展名的文件,那么apache会返回该文件的源代码。解决方法是在LoadphpModule这一行的下面 LoadModulephp5_modulelib/modules/libphp5.so AddTypeapplication/x-httpd-php.php --注意如果你的文件的扩展名是.php一定要加这句 AddTypeapplication/x-httpd-php.php5 --同上,如果你的文件扩展名是.php5一定要加这句 AddTypeapplication/x-httpd-php-source.phps AddTypeapplication/x-httpd-php-source.php5s DirectoryIndexindex.php DirectoryIndexindex.php5 [root@nan87~]#cd/usr/local/apache/htdocs/ [root@nan87htdocs]#vimindex.php [root@nan87htdocs]#/etc/init.d/httpdrestart (6)配置tomcat [root@nan87softs]#tarxvfapache-tomcat-7.0.52.tar.gz [root@nan87softs]#mvapache-tomcat-7.0.52/usr/local/tomcat //给tomcat添加JAVA主目录,在96行添加 [root@nan87softs]#vim/usr/local/tomcat/bin/catalina.sh JAVA_HOME=/usr/java/jdk1.7.0_51 CATALINA_HOME=/usr/local/tomcat //做启动脚本 [root@nan87softs]#cd/usr/local/tomcat/bin [root@nan87bin]#cpcatalina.sh/etc/init.d/tomcat [root@nan87bin]#vim/etc/init.d/tomcat #chkconfig:23757476 #description:tomcatstartstop [root@nan87bin]#chmod+x/etc/init.d/tomcat //配置用户管理 [root@nan87bin]#cd/usr/local/tomcat/conf/ [root@nan87conf]#vimtomcat-users.xml --去掉注释 (7)重启 [root@nan87named]#/etc/init.d/httpdrestart [root@nan87named]#/etc/init.d/namedrestart (8)测试 在客户端浏览器中输入“http://www.dogs.com/” 点击页面任意内容,输入用户名和密码,注意第7步 用户名:tomcat 密码:tomcat


分享标题:linux(apache2.2/2.4+tomcat6/7+php)
网站网址:http://mswzjz.cn/article/chccih.html

其他资讯