• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
  • 貢獻一篇我寫的安裝說明給大家

    發表于:2007-05-25來源:作者:點擊數: 標簽:
    以下這些問題可能和郵件 服務器 沒有多大關系,但是大家安裝郵件服務器的時候卻常會用到,對新手來說這篇文章也許有點幫助! ########################################################################################## Redhat7.3下Apache+ MySQL +PHP+JSP

    以下這些問題可能和郵件服務器沒有多大關系, 但是大家安裝郵件服務器的時候卻常會用到, 對新手來說這篇文章也許有點幫助!

    ##########################################################################################

    Redhat 7.3 下 Apache+MySQL+PHP+JSP 的安裝

    作者: micro (webmaster@fastirc.com)
    時間: 2003 年 5 月 14 日

    本文僅獻給在防治 SARS 工作中作出貢獻的所有中國公民.

    本文介紹在 Redhat 7.3 下安裝 Apache, MySQL, PHP, phpMyAdmin, JDK, RESIN, JDBC 的操作步驟.

    所需軟件:

    apache_1.3.27.tar.gz                      http://www.apache.org/
    php4.2.3.tar.gz                           http://www.php.net/
    mysql-3.23.56.tar.gz                      http://www.mysql.com/
    phpMyAdmin-2.5.0-php.tar.gz               http://sourceforge.net/projects/phpmyadmin/
    j2sdk-1_3_1_08-linux-i586.bin             http://java.sun.com/
    resin-2.1.9.tar.gz                        http://www.caucho.com/
    mm.mysql-2.0.14-you-must-unjar-me.jar     http://sourceforge.net/projects/mmmysql/

    在安裝前我們假設 Redhat 系統中并沒有安裝上述軟件, 或者上述軟件已被停用.

    ##########################################################################################

    安裝順序:

       安裝 MySQL
       配置 Apache 預編譯
       安裝 PHP
       安裝 Apache
       配置 PHP, Apache, phpMyAdmin
       安裝 JDK
       安裝 RESIN
       配置 JSP 作為 Apache 模塊方式運行
       安裝 MySQL JDBC

    ##########################################################################################

    準備安裝:

    1. 登錄 Redhat 系統并切換到 root 用戶.

    2. 假設源文件在 /home/soft/ 目錄下.

       shell> cd /home/soft/

    3. 解軟件包方法

       安裝 rpm 包命令: rpm -ivh *.rpm
       升級 rpm 包命令: rpm -Uvh *.rpm
       解 tar 包命令: tar -xvf *.tar
       解 tgz 和 tar.gz 包命令: tar -xzvf *.tgz
                                tar -xzvf *.tar.gz
    ##########################################################################################

    安裝 MySQL:

       shell> groupadd mysql
       shell> useradd -g mysql mysql
       shell> cd /home/soft/
       shell> tar -zxvf mysql-3.23.56.tar.gz
       shell> cd mysql-3.23.56
       shell> ./configure --prefix=/usr/local/mysql 
       shell> make
       shell> make install
       shell> cd /usr/local/mysql/bin
       shell> ./mysql_install_db
       shell> chown -R root /usr/local/mysql
       shell> chown -R mysql /usr/local/mysql/var
       shell> chgrp -R mysql /usr/local/mysql
       shell> cp /usr/local/mysql/share/mysql/mysql.server ./
       shell> chmod 711 mysql.server
       
       啟動 MySQL:
       shell> ./mysql.server start

       測試 MySQL 是否正常工作:
       shell> ./mysqladmin ping

       顯示 MySQL 的運行狀態:
       shell> ./mysqlshow

       設置 MySQL root 用戶密碼:
       shell> ./mysqladmin -u root password yourpassword

       開機自動啟動 MySQL:
       shell> cd /etc/rc.d
       shell> vi rc.local
       在最后增加一行: /usr/local/mysql/bin/mysql.server start

       關機時自動停止 MySQL:
       shell> cd /etc/rc.d/init.d
       shell> vi killall
       在最后增加一行: /usr/local/mysql/bin/mysql.server stop

       增加 MySQL 全局環境變量:
       shell> vi /etc/profile
       在最后增加一行: PATH=$PATH:/usr/local/mysql/bin:/usr/local/bin
       shell> cp /usr/local/mysql/share/mysql/my-xxx.cnf /etc/my.cnf
       my-xxx.cnf 分別是 my-huge.cnf my-large.cnf my-medium.cnf my-small.cnf
       四個不同的文件, 你需要根據你自己機器的硬件資源情況選擇一個合適你的把它
       復制到 /etc 目錄下并命名為 my.cnf.
       shell> vi /etc/my.cnf
       根據你自己的情況在對 my.cnf 的內容做適當調整,并建議加入這樣一行:
       set-variable    = max_connections=200
       這行的意思是設置一個全局環境變量使得 MySQL 允許的最大并發連接數為 200
       默認是 100 你可以適當增加, 具體的要看服務器硬件資源情況決定.

    ##########################################################################################

    預編譯 Apache:

       首先要停止所有的 http 服務
       shell> killall httpd 
       shell> cd /home/soft/
       shell> tar -zxvf apache_1.3.27.tar.gz
       shell> cd apache_1.3.27
       shell> ./configure --prefix=/usr/local/apache
       
    ##########################################################################################

    安裝 PHP:

       shell> cd /home/soft/
       shell> tar -xzvf php-4.2.3.tar.gz
       shell> cd php-4.2.3
       shell> ./configure --with-mysql=/usr/local/mysql --with-apache=/home/soft/apache_1.3.27 --enable-track-vars --with-charset=gb2312 --with-xml --enable-url-includes --disable-debug --enable-ftp --with-apx
       shell> make
       shell> make install

    ##########################################################################################

    安裝 Apache:
       
       shell> cd /home/soft/apache_1.3.27
       shell> ./configure --prefix=/usr/local/apache --activate-module=src/modules/php4/libphp4.a --enable-module=so
       shell> make
       shell> make install
       shell> cd /home/soft/php-4.2.3
       shell> cp -f php.ini-dist /usr/local/lib/php.ini
       shell> vi /usr/local/lib/php.ini
       按自己的情況配置 php.ini 文件, 如果你需要兼容 php-4.1.2 以前所開發
       一些 PHP 程序建議把其中的 register_globals = Off 設置為 On. 但是這可
       能會帶來一些安全問題, 所以 PHP 從 4.2 版本開始默認設置是 Off.

       配置 Apache:
       shell> cd /usr/loca/apache/conf
       shell> vi httpd.conf
       去掉 "#ServerName ……" 行前的 "#" 號, 把服務器名字定義為你的域名;
       將 "MaxClients 150" 修改成 "MaxClients 256" 默認 Linux 下的 Apache 并發連接最高 256;
       還需要修改以下幾行:
       <IfModule mod_dir.c>
        DirectoryIndex index.html index.htm index.php index.php3
       </IfModule>
       追加以下幾行:
       AddType application/x-httpd-php .php
       AddType application/x-httpd-php .inc
       AddType application/x-httpd-php .php3
       AddType application/x-httpd-php .phtml
       AddType application/x-httpd-php-source .phps

       啟動 Apache:
       shell> /usr/local/apache/bin/apachectl start

       開機自動啟動 Apache:
       shell> vi /etc/rc.d/rc.local
       在最后增加一行: /usr/local/apache/bin/apachectl start

    ##########################################################################################

    配置 phpMyAdmin-2.5.0:

       shell> cd /home/soft
       shell> tar -zxvf phpMyAdmin-2.5.0-php.tar.gz
       shell> mv phpMyAdmin-2.5.0 /usr/local/apache/htdocs/phpMyAdmin
       shell> cd /usr/local/apache/htdocs/phpMyAdmin
       shell> vi config.inc.php
       修改以下幾行:
       $cfg['PmaAbsoluteUri'] = 'http://yourdomainname/phpMyAdmin/';
       $cfg['Servers'][$i]['controluser']   = 'root';
       $cfg['Servers'][$i]['controlpass']   = 'yourpassword';
       $cfg['Servers'][$i]['auth_type']     = 'cookie';
       $cfg['Servers'][$i]['user']          = 'root';
       $cfg['Servers'][$i]['password']      = 'yourpassword';
       $cfg['DefaultLang'] = 'zh';
       $cfg['DefaultCharset'] = 'gb2312';

    ##########################################################################################

    測試工作:

    1. 進行測試前建議首先重新啟動服務器
       
       shell> reboot
       
    2. 測試 PHP

       shell> cd /usr/local/apache/htdocs
       shell> vi info.php
       測試文件內容如下: 
       <? phpinfo(); ?>
       在瀏覽器中訪問 http://yourdomainname/info.php, 將得到有關 PHP 的運行資料.

    3. 測試 phpMyAdmin

       在瀏覽器中訪問 http://yourdomainname/phpMyAdmin/
       輸入 MySQL 用戶名和密碼后就可以登陸 phpMyAdmin 實現對 MySQL 的 WEB 管理.

    ##########################################################################################

    安裝 JDK:

       shell> cd /home/soft
       shell> ./j2sdk-1_3_1_08-linux-i586.bin
       閱讀許可協議后輸入 yes 表示同意 jdk 許可協議, 程序將進行自動解壓縮工作.
       shell> mv jdk1.3.1_08 /usr/local/jdk
       shell> cd /usr/local
       shell> ln -s /usr/local/jdk/jre jre
       shell> vi /etc/profile
       在最后加入:
       JAVA_HOME=/usr/local/jdk
       export JAVA_HOME
       CLASSPATH=$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar
       export CLASSPATH
       PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin
       export PATH
       以上操作完成后退出系統重新登陸使環境變量生效.

    ##########################################################################################

    安裝 RESIN:
        
       shell> cd /home/soft
       shell> tar -xzvf resin-2.1.9.tar.gz
       shell> mv resin-2.1.9 /usr/local/resin
       shell> vi /etc/profile
       在最后加入:
       RESIN_HOME=/usr/local/resin
       export RESIN_HOME

       以上操作完成后退出系統重新登陸使環境變量生效.

       啟動 RESIN
       shell> /usr/local/resin/bin/httpd.sh start
       在瀏覽器中訪問 http://yourdomainname:8080 如果看到 "Resin? Default Home Page"
       的頁面出現表示 RESIN 安裝成功了.
       你可以通過編輯 /usr/local/resin/conf/resin.conf 文件來對 RESIN 進行配置.

    ##########################################################################################
       
    配置 JSP 作為 Apache 模塊方式運行:
       
       以下文檔修改自 http://www.caucho.com/resin/ref/cse-apache-unix.xtp
       
       shell> cd /usr/local/resin
       shell> ./configure --with-apxs=/usr/local/apache/bin/apxs
       shell> make
       shell> ./configure --with-apache=/usr/local/apache
       shell> make
       shell> make install
       shell> /usr/local/resin/bin/httpd.sh stop
       shell> cd /usr/local/resin/conf
       shell> mv resin.conf resin.conf.bak
       shell> vi resin.conf
       新建 RESIN 配置文件內容如下:
       <caucho.com>
         <http-server 
             app-dir='/usr/local/apache/htdocs'>
           <http port='8080'/>
           <srun host='localhost' port='6802'/>
           <servlet-mapping url-pattern='/servlets/*'
                     servlet-name='invoker'/>

           <servlet-mapping url-pattern='*.xtp'
                               servlet-name='com.caucho.jsp.XtpServlet'/>
           <servlet-mapping url-pattern='*.jsp'
                               servlet-name='com.caucho.jsp.JspServlet'/>
         </http-server>
       </caucho.com>

       shell> /usr/local/resin/bin/httpd.sh start
       shell> vi /usr/local/apache/htdocs/test.jsp
       測試文件內容如下:
       2 + 2 = <%= 2 + 2 %>

       在瀏覽器中訪問 http://yourdomainname/test.jsp 如果看到顯示為 "2 + 2 = 4"
       表示 JSP 已經可以作為 Apache 模塊方式運行了.

       默認在編譯 mod_caucho 模塊的時候程序會自動在 httpd.conf 文件中增加以下內容:

       LoadModule caucho_module /usr/local/apache/libexec/mod_caucho.so

       CauchoConfigFile /usr/local/resin/conf/resin.conf
       
       一般情況下這樣時候就可以滿足使用需求了如果你需要手工配置可以參考以下內容:

       LoadModule caucho_module libexec/mod_caucho.so
       AddModule mod_caucho.c

       <IfModule mod_caucho.c>
         CauchoConfigFile <installdir>/resin/conf/resin.conf
         <Location /caucho-status>
           SetHandler caucho-status
         </Location>
       </IfModule>

       想獲得更多的關于 Resin with Apache 的說明請訪問:
       http://www.caucho.com/resin/ref/cse-apache-unix.xtp

       注意: 以上方法存在一些安全隱患, 比如用戶可以通過訪問一個 URL 地址查看到你
       PHP 只類的中間件程序的原代碼.
       例如: http://yourdomainname:8080/phpMyAdmin/config.inc.php 就相當危險.
       由于 RESIN 無法處理 PHP 文件所以將 PHP 文件作為文本方式顯示了出來, 這樣可
       能會出現一系列安全問題, 比如數據庫密碼被盜等等. 建議對 Apache, RESIN 做進
       一步的嚴格設置后才能正式使用, 或者干脆不將 JSP 作為 Apache 模塊方式運行.

    ##########################################################################################

    安裝 MySQL JDBC 驅動:

       shell> cd /home/soft
       shell> jar -xvf mm.mysql-2.0.14-you-must-unjar-me.jar
       shell> cd mm.mysql-2.0.14
       shell> cp mm.mysql-2.0.14-bin.jar /usr/local/jdk/lib/
       shell> vi /etc/proflie
       在 CLASSPATH 行最后追加 :$JAVA_HOME/lib/mm.mysql-2.0.14-bin.jar

       以上操作完成后退出系統重新登陸使環境變量生效.

       shell> mysql -u root -p -h localhost
       系統會提示輸入密碼輸入你設置好 root 用戶密碼就可以進入 mysql 字符管理界面.

       以下命令在 MySQL 中增加一個 root@127.0.0.1 的用戶此用戶具有對所有數據庫和表的操作權限:
       shell> mysql> grant all privileges on *.* to root@127.0.0.1 identified by 'yourpassword';
       shell> vi /usr/local/apache/htdocs/testjdbc.jsp
       測試文件內容如下:
       <%@ page contentType="text/html;charset=gb2312" %>
       <%
         java.sql.Connection conn;
         java.lang.String strConn;
         Class.forName("org.gjt.mm.mysql.Driver").newInstance();
         conn = java.sql.DriverManager.getConnection("jdbc:mysql://127.0.0.1/test?user=root&password=yourpassword");
       %>
       shell> /usr/local/resin/bin/httpd.sh restart

       在瀏覽器中訪問 http://yourdomainname/testjdbc.jsp 如果沒有顯示出錯, 只顯示
       出一個空白頁面就表示聯結已經成功.

    ##########################################################################################

     lianyong 回復于:2003-05-14 20:40:21
    支持,辛苦了

     gadfly 回復于:2003-05-14 21:24:41
    risin沒用過,不知道和tomcat比,有什么優勢。

    支持原創!

     lix1216 回復于:2003-05-15 14:27:46
    謝謝你

     iotigod 回復于:2003-05-15 16:27:57
    請問freebsd下能夠按照這種配置來建立支持jsp的web服務器嗎?

     dtedu 回復于:2003-05-15 16:51:41
    支持原創!不錯。有空再做個實驗!

     afanofamd 回復于:2003-05-15 17:51:29
    相同硬件配置下resin要比Tomcat快好多,且對中文支持比較不錯

    關于resin和apache集成的安全問題,你關掉resin的8080端口就可以了,改配置文件。因為不需要resin在8080端口提供http服務,已經由apache在80提供了

     bearly 回復于:2003-06-11 14:24:43
    支持

     roadli 回復于:2003-06-11 14:29:45
    嚴重支持!呵呵!

     wolf1980 回復于:2003-06-11 17:37:28
    RE

    原文轉自:http://www.kjueaiud.com

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>