歡迎您光臨本站 註冊首頁

配置Sun ONE Web Server支持JSP,PHP,CGI

←手機掃碼閱讀     火星人 @ 2014-03-12 , reply:0
  配置Sun ONE Web Server 6.1支持JSP,PHP,CGI

前言:

目前在linux系統上,存在兩個最強的web伺服器,一個是apache一個就是,sun的Sun ONE Web Server,在網路上最apache的各種應用
寫的比較多,但是Sun ONE Web Server 則比較少,今日閑來無事,便寫了一個簡單的配置教程

所需軟體(因為軟體較大無法提供本地下載)

1,Sun ONE Web Server 6.1

下載地址

http://wwws.sun.com/software/download/products/3f4f998d.html,在sun的主頁上,是OEM版,60多M下載需要註冊

2,php 4.3.6

x下載地址
http://cn.php.net/get/php-4.3.6.tar.bz2/from/a/mirror

首先安裝SUN ONE web server ,解壓縮sun-webserver61-rh72.tar.gz這個軟體包,到一個目錄里,例如sun,然後運行安裝程序

cd /sun
tar -zxf sun-webserver61-rh72.tar.gz
./setup

以root進行安裝

過程如下,基本安默認安裝就行

Would you like to continue with installation? [Yes]: 回車
Do you agree to the license terms? [No]:yes

Choose an installation type:

1. Express installation
Allows you to quickly install the servers using the most
common options and pre-defined defaults. Useful for quick
evaluation of the products.

2. Typical installation
Allows you to specify common defaults and options.

3. Custom installation
Allows you to specify more advanced options. This is
recommended for experienced server administrators only.

To accept the default shown in brackets, press the Enter key.

Choose an installation type [2]: 回車(建議安典型安裝)

Install location [/opt/SUNWwbsvr]:回車(默認安裝目錄)
Sun ONE Web Server components:

Components with a number in () contain additional subcomponents
which you can select using subsequent screens.

1. Sun ONE Web Server, Enterprise Edition (2)


Specify the components you wish to install [All]:回車(安裝Sun ONE Web Server, Enterprise Edition)

Components with a number in () contain additional subcomponents
which you can select using subsequent screens.

1. Server Core
2. Java Development Kit


Specify the components you wish to install [1, 2]: 回車(安裝代碼和開發包)

To accept the default shown in brackets, press the Enter key.

Computer name [lee.(none)]:回車(設置域名,默認主機名)

System User [nobody]:回車(設置啟動這個服務的用戶)
System Group [nobody]:回車(設置啟動這個服務的用戶組)
Run Web Server Administration Server as [root]:回車(運行管理服務的用戶)
Web Server Admin Server User Name [admin]:回車(web管理員用戶名)
Web Server Admin Server Password:(密碼)
Web Server Admin Server Password (again):(確認密碼)
Web Server Admin Server Port [8888]:回車(web管理的埠)
Web Server Port [80]:回車(運行web服務的埠一般是80,因為我的伺服器裝了apache,所以改成了88)
Web Server Content Root [/opt/SUNWwbsvr/docs]:回車(網頁根目錄)
Web Server Start On Boot [yes]:回車(引導時啟動)
然後會拷貝安裝文件,一切順利,就會安裝完畢。

因為sun one web server本身支持jsp,所以不用配置。
下面介紹如何,配置cgi和php

首先配置CGI

cd /opt/SUNWwbsvr/https-lee/config
進入虛擬伺服器的配置目錄
vi obj.conf
打開配置文件,並加入如下內容
的下面加入
Service fn="send-cgi" type="magnus-internal/cgi" user="$user" group="$group" dir="$dir" chroot="$chroot" nice="$nice"

在文件最後加入

ObjectType fn="force-type" type="magnus-internal/cgi"
Service fn="send-cgi" user="$user" group="$group" dir="$dir" chroot="$chroot" nice="$nice"

如果這段有,就不必加入了

然後運行
cd /opt/SUNWwbsvr/https-lee
./restart重啟動伺服器。
這樣在sun one web server就能運行cgi程序了,sun one web server本身是支持CGI的,這段配置是將CGI功能打開

配置php

首先加壓縮軟體包
tar -jxf php-4.3.6.tar.bz2
cd php-4.3.6
./configure --with-nsapi=/opt/SUNWwbsvr --with-mysql=/usr/local/mysql 第一個參數是創建一個sun one的nsapi插件第二個參數是讓php在sun one支持mysql

make

因為我已經安裝了PHP,所以並沒有運行make install 進行安裝以避免以前的PHP配置,如果您沒有安裝PHP輕運行make install 進行安裝

make完畢后在php-4.3.6/libs中會有一個libphp4.so這個文件就是我們要的nsapi插件
將這個文件拷貝到/opt/SUNWwbsvr/bin
cp libphp4.so /opt/SUNWwbsvr/bin
這樣,插件已經製作完成
最後將php-4.3.6目錄下的php.ini-dist拷貝到/etc下並改名php.ini
cp php-4.3.6/php.ini-dist /etc/php.ini
下面開始配置sun one web server

cd /opt/SUNWwbsvr/https-lee/config
vi obj.conf
的下面加入
Service fn="php4_execute" type="magnus-internal/x-httpd-php"

並在文件末尾加入

ObjectType fn="force-type" type="magnus-internal/x-httpd-php"
Service fn="php4_execute" [inikey="value" inikey="value" 4="...]"

保存文件

然後打開 magnus.conf

vi magnus.conf
在文件末尾加入
Init fn="load-modules" funcs="php4_init,php4_execute,php4_auth_trans" shlib="/opt/SUNWwbsvr/bin/libphp4.so"
Init fn="php4_init" errorString="Failed to initialize PHP!" [php_ini="/etc/php.ini"]
保存文件

打開mime.types
vi mime.types
在文件末尾加入
type=magnus-internal/x-httpd-php exts=php,php3
保存文件

最後
cd /opt/SUNWwbsvr/https-lee
./restart重啟動伺服器


這樣伺服器基本配置完成

有些東西也可以使用web在線配置。
如果大家有 問題在一起討論
http://www.leftworld.net/shequ/forums.cgi?forum=17
我提供給大家一個配置好的配置文件僅供參考。也可以拿來稍作修改,並使用.
地址:
http://www.leftworld.org/sun/sun.html
注意:
如果想要將此伺服器進行應用請下載他的更新包sp1 sp2




[火星人 ] 配置Sun ONE Web Server支持JSP,PHP,CGI已經有685次圍觀

http://coctec.com/docs/linux/show-post-67685.html