2007年12月24日 星期一

Service: Apache - User's Personal web site


基礎需求:
帳號設定篇,套件安裝篇,apache基本操作篇

環境設定:
rpm -q httpd mod_ssl
若無相關套件請參照套件安裝篇: Utility: rpm + yum
service iptables stop

1. 在網頁空間設定上首要注意資料夾權限與SElinux設定在本次實做中以分享/home/alex為例:

useradd alex

cd /home/alex

mkdir public_html

chmod 701 /home/alex

chmod 701 /home/alex/public_html

cd /home/alex/public_html

cat >> index.html
<b> Welcome2Alex's Web Site</b>
ctrl-D

restorecon -R -v public_html

2.修改 /etc/httpd/conf/httpd.conf 約在338行開始處尋找以下字串

#
# UserDir: The name of the directory that is appended onto a user's home
# directory if a ~user request is received.
#
# The path to the end user account 'public_html' directory must be
# accessible to the webserver userid. This usually means that ~userid
# must have permissions of 711, ~userid/public_html must have permissions
# of 755, and documents contained therein must be world-readable.
# Otherwise, the client will only receive a "403 Forbidden" message.
#
# See also: http://httpd.apache.org/docs/misc/FAQ.html#forbidden
#
<IfModule mod_userdir.c>
#
# UserDir is disabled by default since it can confirm the presence
# of a username on the system (depending on home directory
# permissions).
#
#UserDir disable

#
# To enable requests to /~user/ to serve the user's public_html
# directory, remove the "UserDir disable" line above, and uncomment
# the following line instead:
#
UserDir public_html

</IfModule>

#
# Control access to UserDir directories. The following is an example
# for a site where these directories are restricted to read-only.
#
<Directory /home/*/public_html>
AllowOverride FileInfo AuthConfig Limit
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
# AllowOverride AuthConfig
# AuthType Basic
# AuthName "Passwd Protected Test"
# AuthUserFile /etc/httpd/.htpasswd
# require valid-user

# <Limit GET POST OPTIONS>
# Order allow,deny
# Allow from all
# </Limit>
# <LimitExcept GET POST OPTIONS>
# Order deny,allow
# Deny from all
# </LimitExcept>
</Directory>

設定值解說
  • 將UserDir disable設定改為 #UserDir disable並改為UserDir public_html,便是將預設的個人網頁空間設定為/home/*/public/html
  • 設定密碼保護
# AllowOverride AuthConfig
# AuthType Basic
# AuthName "Passwd Protected Test"
# AuthUserFile /etc/httpd/.htpasswd
# require valid-user

將以上字串的#字號拿掉後在加入以下的指令:

htpasswd -cm /etc/httpd/.htpasswd alex

chmod 640 /etc/httpd/.htpasswd

在進入網頁時便會要求輸入帳號密碼,即User based的保護機制,如下圖所示:

links http://server1/~alex

3. 檢查設定檔與執行

請執行以下指令

httpd -t

apachectl restart

4. 測試網頁

links http://ip-web service host/~alex

2007年12月5日 星期三

VNCServer 遠端桌面管理(IE Exporler控制遠端Linux主機)

前言:

在以下的裝備中,我們安裝一台windows XP主機,而另一台為Linux red hat 7.2的主機,我們將使用windows XP主機操控Linux主機的桌面。

  1. 套件安裝

    1. 下載所需套件

www.realvnc.com

    1. 安裝

在以下的安裝中,分別對windows端以及Linux端作個別的介紹。

Linux

      1. 程式解壓縮,以我下載的vnc-4_1_2-x86_linux[1].tar為例,進入檔案下載的目錄後,輸入:

tar zxvf vnc-4_1_2-x86_linux[1].tar

      1. 主程式及man page安裝

./vncinstall /usr/local/bin /usr/local/man

      1. Java VNCViewer的安裝

mkdir –p /usr/local/vnc/classes

cp java/* /usr/local/vnc/classes

Windows1

雙擊兩下即可安裝。

Linux Server

啟動VNCServer

mkdir ~/.vnc

vncpasswd

vncserver


防火牆設定

iptables –I INPUT –s 192.68.1.0/24 –p tcp –dport 5801 –j ACCEPT

iptables –I INPUT –s 192.68.1.0/24 –p tcp –dport 5901 –j ACCEPT

iptables –I INPUT –s 192.68.1.0/24 –p tcp –dport 6001 –j ACCEPT


Windows

IE Explorler中輸入位置 http://192.168.1.3:5801


驗證的畫面

登入成功摟。

1 Windows端還需要java環境才可以利用VNC進行遠端桌面管理。