<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    ivaneeo's blog

    自由的力量,自由的生活。

      BlogJava :: 首頁 :: 聯系 :: 聚合  :: 管理
      669 Posts :: 0 Stories :: 64 Comments :: 0 Trackbacks

    #

    編輯
    作用域   功能   快捷鍵  
    全局   查找并替換   Ctrl+F  
    文本編輯器   查找上一個   Ctrl+Shift+K  
    文本編輯器   查找下一個   Ctrl+K  
    全局   撤銷   Ctrl+Z  
    全局   復制   Ctrl+C  
    全局   恢復上一個選擇   Alt+Shift+↓  
    全局   剪切   Ctrl+X  
    全局   快速修正   Ctrl1+1  
    全局   內容輔助   Alt+/  
    全局   全部選中   Ctrl+A  
    全局   刪除   Delete  
    全局   上下文信息   Alt+?
    Alt+Shift+?
    Ctrl+Shift+Space  
    Java編輯器   顯示工具提示描述   F2  
    Java編輯器   選擇封裝元素   Alt+Shift+↑  
    Java編輯器   選擇上一個元素   Alt+Shift+←  
    Java編輯器   選擇下一個元素   Alt+Shift+→  
    文本編輯器   增量查找   Ctrl+J  
    文本編輯器   增量逆向查找   Ctrl+Shift+J  
    全局   粘貼   Ctrl+V  
    全局   重做   Ctrl+Y  


     
    查看
    作用域   功能   快捷鍵  
    全局   放大   Ctrl+=  
    全局   縮小   Ctrl+-  


     
    窗口
    作用域   功能   快捷鍵  
    全局   激活編輯器   F12  
    全局   切換編輯器   Ctrl+Shift+W  
    全局   上一個編輯器   Ctrl+Shift+F6  
    全局   上一個視圖   Ctrl+Shift+F7  
    全局   上一個透視圖   Ctrl+Shift+F8  
    全局   下一個編輯器   Ctrl+F6  
    全局   下一個視圖   Ctrl+F7  
    全局   下一個透視圖   Ctrl+F8  
    文本編輯器   顯示標尺上下文菜單   Ctrl+W  
    全局   顯示視圖菜單   Ctrl+F10  
    全局   顯示系統菜單   Alt+-  


    導航
    作用域   功能   快捷鍵  
    Java編輯器   打開結構   Ctrl+F3  
    全局   打開類型   Ctrl+Shift+T  
    全局   打開類型層次結構   F4  
    全局   打開聲明   F3  
    全局   打開外部javadoc   Shift+F2  
    全局   打開資源   Ctrl+Shift+R  
    全局   后退歷史記錄   Alt+←  
    全局   前進歷史記錄   Alt+→  
    全局   上一個   Ctrl+,  
    全局   下一個   Ctrl+.  
    Java編輯器   顯示大綱   Ctrl+O  
    全局   在層次結構中打開類型   Ctrl+Shift+H  
    全局   轉至匹配的括號   Ctrl+Shift+P  
    全局   轉至上一個編輯位置   Ctrl+Q  
    Java編輯器   轉至上一個成員   Ctrl+Shift+↑  
    Java編輯器   轉至下一個成員   Ctrl+Shift+↓  
    文本編輯器   轉至行   Ctrl+L  

     
    搜索
    作用域   功能   快捷鍵  
    全局   出現在文件中   Ctrl+Shift+U  
    全局   打開搜索對話框   Ctrl+H  
    全局   工作區中的聲明   Ctrl+G  
    全局   工作區中的引用   Ctrl+Shift+G  

     
    文本編輯
    作用域   功能   快捷鍵  
    文本編輯器   改寫切換   Insert  
    文本編輯器   上滾行   Ctrl+↑  
    文本編輯器   下滾行   Ctrl+↓  

     
    文件
    作用域   功能   快捷鍵  
    全局   保存   Ctrl+X  
    Ctrl+S  
    全局   打印   Ctrl+P  
    全局   關閉   Ctrl+F4  
    全局   全部保存   Ctrl+Shift+S  
    全局   全部關閉   Ctrl+Shift+F4  
    全局   屬性   Alt+Enter  
    全局   新建   Ctrl+N  

     
    項目
    作用域   功能   快捷鍵  
    全局   全部構建   Ctrl+B  

    源代碼
    作用域   功能   快捷鍵  
    Java編輯器   格式化   Ctrl+Shift+F  
    Java編輯器   取消注釋   Ctrl+\  
    Java編輯器   注釋   Ctrl+/  
    Java編輯器   添加導入   Ctrl+Shift+M  
    Java編輯器   組織導入   Ctrl+Shift+O  
    Java編輯器   使用try/catch塊來包圍   未設置,太常用了,所以在這里列出,建議自己設置。
    也可以使用Ctrl+1自動修正。  

     
    運行
    作用域   功能   快捷鍵  
    全局   單步返回   F7  
    全局   單步跳過   F6  
    全局   單步跳入   F5  
    全局   單步跳入選擇   Ctrl+F5  
    全局   調試上次啟動   F11  
    全局   繼續   F8  
    全局   使用過濾器單步執行   Shift+F5  
    全局   添加/去除斷點   Ctrl+Shift+B  
    全局   顯示   Ctrl+D  
    全局   運行上次啟動   Ctrl+F11  
    全局   運行至行   Ctrl+R  
    全局   執行   Ctrl+U  

     
    重構
    作用域   功能   快捷鍵  
    全局   撤銷重構   Alt+Shift+Z  
    全局   抽取方法   Alt+Shift+M  
    全局   抽取局部變量   Alt+Shift+L  
    全局   內聯   Alt+Shift+I  
    全局   移動   Alt+Shift+V  
    全局   重命名   Alt+Shift+R  
    全局   重做   Alt+Shift+Y  
    posted @ 2011-12-16 10:30 ivaneeo 閱讀(286) | 評論 (0)編輯 收藏

    configure 腳本確定系統所具有一些特性,特別是 nginx 用來處理連接的方法。然后,它創建 Makefile 文件。

    configure 支持下面的選項:

    --prefix=<path> - Nginx安裝路徑。如果沒有指定,默認為 /usr/local/nginx。

    --sbin-path=<path> - Nginx可執行文件安裝路徑。只能安裝時指定,如果沒有指定,默認為<prefix>/sbin/nginx。

    --conf-path=<path> - 在沒有給定-c選項下默認的nginx.conf的路徑。如果沒有指定,默認為<prefix>/conf/nginx.conf。

    --pid-path=<path> - 在nginx.conf中沒有指定pid指令的情況下,默認的nginx.pid的路徑。如果沒有指定,默認為 <prefix>/logs/nginx.pid。

    --lock-path=<path> - nginx.lock文件的路徑。

    --error-log-path=<path> - 在nginx.conf中沒有指定error_log指令的情況下,默認的錯誤日志的路徑。如果沒有指定,默認為 <prefix>/logs/error.log。

    --http-log-path=<path> - 在nginx.conf中沒有指定access_log指令的情況下,默認的訪問日志的路徑。如果沒有指定,默認為 <prefix>/logs/access.log。

    --user=<user> - 在nginx.conf中沒有指定user指令的情況下,默認的nginx使用的用戶。如果沒有指定,默認為 nobody。

    --group=<group> - 在nginx.conf中沒有指定user指令的情況下,默認的nginx使用的組。如果沒有指定,默認為 nobody。

    --builddir=DIR - 指定編譯的目錄

    --with-rtsig_module - 啟用 rtsig 模塊

    --with-select_module --without-select_module - Whether or not to enable the select module. This module is enabled by default if a more suitable method such as kqueue, epoll, rtsig or /dev/poll is not discovered by configure.

    //允許或不允許開啟SELECT模式,如果 configure 沒有找到更合適的模式,比如:kqueue(sun os),epoll (linux kenel 2.6+), rtsig(實時信號)或者/dev/poll(一種類似select的模式,底層實現與SELECT基本相 同,都是采用輪訓方法) SELECT模式將是默認安裝模式

    --with-poll_module --without-poll_module - Whether or not to enable the poll module. This module is enabled by default if a more suitable method such as kqueue, epoll, rtsig or /dev/poll is not discovered by configure.

    --with-http_ssl_module - Enable ngx_http_ssl_module. Enables SSL support and the ability to handle HTTPS requests. Requires OpenSSL. On Debian, this is libssl-dev.

    //開啟HTTP SSL模塊,使NGINX可以支持HTTPS請求。這個模塊需要已經安裝了OPENSSL,在DEBIAN上是libssl-dev

    --with-http_realip_module - 啟用 ngx_http_realip_module

    --with-http_addition_module - 啟用 ngx_http_addition_module

    --with-http_sub_module - 啟用 ngx_http_sub_module

    --with-http_dav_module - 啟用 ngx_http_dav_module

    --with-http_flv_module - 啟用 ngx_http_flv_module

    --with-http_stub_status_module - 啟用 "server status" 頁

    --without-http_charset_module - 禁用 ngx_http_charset_module

    --without-http_gzip_module - 禁用 ngx_http_gzip_module. 如果啟用,需要 zlib 。

    --without-http_ssi_module - 禁用 ngx_http_ssi_module

    --without-http_userid_module - 禁用 ngx_http_userid_module

    --without-http_access_module - 禁用 ngx_http_access_module

    --without-http_auth_basic_module - 禁用 ngx_http_auth_basic_module

    --without-http_autoindex_module - 禁用 ngx_http_autoindex_module

    --without-http_geo_module - 禁用 ngx_http_geo_module

    --without-http_map_module - 禁用 ngx_http_map_module

    --without-http_referer_module - 禁用 ngx_http_referer_module

    --without-http_rewrite_module - 禁用 ngx_http_rewrite_module. 如果啟用需要 PCRE 。

    --without-http_proxy_module - 禁用 ngx_http_proxy_module

    --without-http_fastcgi_module - 禁用 ngx_http_fastcgi_module

    --without-http_memcached_module - 禁用 ngx_http_memcached_module

    --without-http_limit_zone_module - 禁用 ngx_http_limit_zone_module

    --without-http_empty_gif_module - 禁用 ngx_http_empty_gif_module

    --without-http_browser_module - 禁用 ngx_http_browser_module

    --without-http_upstream_ip_hash_module - 禁用 ngx_http_upstream_ip_hash_module

    --with-http_perl_module - 啟用 ngx_http_perl_module

    --with-perl_modules_path=PATH - 指定 perl 模塊的路徑

    --with-perl=PATH - 指定 perl 執行文件的路徑

    --http-log-path=PATH - Set path to the http access log

    --http-client-body-temp-path=PATH - Set path to the http client request body temporary files

    --http-proxy-temp-path=PATH - Set path to the http proxy temporary files

    --http-fastcgi-temp-path=PATH - Set path to the http fastcgi temporary files

    --without-http - 禁用 HTTP server

    --with-mail - 啟用 IMAP4/POP3/SMTP 代理模塊

    --with-mail_ssl_module - 啟用 ngx_mail_ssl_module

    --with-cc=PATH - 指定 C 編譯器的路徑

    --with-cpp=PATH - 指定 C 預處理器的路徑

    --with-cc-opt=OPTIONS - Additional parameters which will be added to the variable CFLAGS. With the use of the system library PCRE in FreeBSD, it is necessary to indicate --with-cc-opt="-I /usr/local/include". If we are using select() and it is necessary to increase the number of file descriptors, then this also can be assigned here: --with-cc-opt="-D FD_SETSIZE=2048".

    --with-ld-opt=OPTIONS - Additional parameters passed to the linker. With the use of the system library PCRE in FreeBSD, it is necessary to indicate --with-ld-opt="-L /usr/local/lib".

    --with-cpu-opt=CPU - 為特定的 CPU 編譯,有效的值包括:pentium, pentiumpro, pentium3, pentium4, athlon, opteron, amd64, sparc32, sparc64, ppc64

    --without-pcre - 禁止 PCRE 庫的使用。同時也會禁止 HTTP rewrite 模塊。在 "location" 配置指令中的正則表達式也需要 PCRE 。

    --with-pcre=DIR - 指定 PCRE 庫的源代碼的路徑。

    --with-pcre-opt=OPTIONS - Set additional options for PCRE building.

    --with-md5=DIR - Set path to md5 library sources.

    --with-md5-opt=OPTIONS - Set additional options for md5 building.

    --with-md5-asm - Use md5 assembler sources.

    --with-sha1=DIR - Set path to sha1 library sources.

    --with-sha1-opt=OPTIONS - Set additional options for sha1 building.

    --with-sha1-asm - Use sha1 assembler sources.

    --with-zlib=DIR - Set path to zlib library sources.

    --with-zlib-opt=OPTIONS - Set additional options for zlib building.

    --with-zlib-asm=CPU - Use zlib assembler sources optimized for specified CPU, valid values are: pentium, pentiumpro

    --with-openssl=DIR - Set path to OpenSSL library sources

    --with-openssl-opt=OPTIONS - Set additional options for OpenSSL building

    --with-debug - 啟用調試日志

    --add-module=PATH - Add in a third-party module found in directory PATH

    在不同版本間,選項可能會有些許變化,請總是使用 ./configure --help 命令來檢查一下當前的選項列表。

    posted @ 2011-12-13 15:01 ivaneeo 閱讀(334) | 評論 (0)編輯 收藏

    見配置,摘自nginx.conf 里的server 段:

    server { listen 80; server_name abc.163.com ; location / { proxy_pass http://ent.163.com/ ; } location /star/ { proxy_pass http://ent.163.com ; } }

    里面有兩個location,我先說第一個,/ 。其實這里有兩種寫法,分別是:

    location / { proxy_pass http://ent.163.com/ ; }
    location / { proxy_pass http://ent.163.com ; }

    出來的效果都一樣的。

    第二個location,/star/。同樣兩種寫法都有,都出來的結果,就不一樣了。

    location /star/ { proxy_pass http://ent.163.com ; }

    當訪問 http://abc.163.com/star/ 的時候,nginx 會代理訪問到 http://ent.163.com/star/ ,并返回給我們。

    location /star/ { proxy_pass http://ent.163.com/ ; }

    當訪問 http://abc.163.com/star/ 的時候,nginx 會代理訪問到 http://ent.163.com/ ,并返回給我們。

    這兩段配置,分別在于, proxy_pass http://ent.163.com/ ; 這個”/”,令到出來的結果完全不同。

    前者,相當于告訴nginx,我這個location,是代理訪問到http://ent.163.com 這個server的,我的location是什么,nginx 就把location 加在proxy_pass 的 server 后面,這里是/star/,所以就相當于 http://ent.163.com/star/。如果是location /blog/ ,就是代理訪問到 http://ent.163.com/blog/。

    后者,相當于告訴nginx,我這個location,是代理訪問到http://ent.163.com/的,http: //abc.163.com/star/ == http://ent.163.com/ ,可以這樣理解。改變location,并不能改變返回的內容,返回的內容始終是http://ent.163.com/ 。 如果是location /blog/ ,那就是 http://abc.163.com/blog/ == http://ent.163.com/ 。

    這樣,也可以解釋了上面那個location / 的例子,/ 嘛,加在server 的后面,仍然是 / ,所以,兩種寫法出來的結果是一樣的。

    PS: 如果是 location ~* ^/start/(.*)\.html 這種正則的location,是不能寫”/”上去的,nginx -t 也會報錯的了。因為,路徑都需要正則匹配了嘛,并不是一個相對固定的locatin了,必然要代理到一個server。

    posted @ 2011-12-13 13:21 ivaneeo 閱讀(514) | 評論 (0)編輯 收藏

    location

    syntax: location [=|~|~*|^~] /uri/ { … }
    語法:location [=|~|~*|^~] /uri/ { … }

    default: no
    默認:否

    context: server
    上下文:server

    This directive allows different configurations depending on the URI. It can be configured using both conventional strings and regular expressions. To use regular expressions, you must use the prefix ~* for case insensitive match and ~ for case sensitive match.
    這個指令隨URL不同而接受不同的結構。你可以配置使用常規字符串和正則表達式。如果使用正則表達式,你必須使用 ~* 前綴選擇不區分大小寫的匹配或者 ~ 選擇區分大小寫的匹配。

    To determine which location directive matches a particular query, the conventional strings are checked first. Conventional strings match the beginning portion of the query and are case-sensitive – the most specific match will be used (see below on how nginx determines this). Afterwards, regular expressions are checked in the order defined in the configuration file. The first regular expression to match the query will stop the search. If no regular expression matches are found, the result from the convention string search is used.
    確定 哪個location 指令匹配一個特定指令,常規字符串第一個測試。常規字符串匹配請求的開始部分并且區分大小寫,最明確的匹配將會被使用(查看下文明白 nginx 怎么確定它)。然后正則表達式按照配置文件里的順序測試。找到第一個比配的正則表達式將停止搜索。如果沒有找到匹配的正則表達式,使用常規字符串的結果。

    There are two ways to modify this behavior. The first is to use the prefix “=”, which matches an exact query only. If the query matches, then searching stops and the request is handled immediately. For example, if the request “/” occurs frequently, then using “location = /” will expedite the processing of this request.
    有兩個方法修改這個行為。第一個方法是使用 “=”前綴,將只執行嚴格匹配。如果這個查詢匹配,那么將停止搜索并立即處理這個請求。例子:如果經常發生”/”請求,那么使用 “location = /” 將加速處理這個請求。

    The second is to use the prefix ^~. This prefix is used with a conventional string and tells nginx to not check regular expressions if the path provided is a match. For instance, “location ^~ /images/” would halt searching if the query begins with /images/ – all regular expression directives would not be checked.
    第二個是使用 ^~ 前綴。如果把這個前綴用于一個常規字符串那么告訴nginx 如果路徑匹配那么不測試正則表達式。

    Furthermore it is important to know that NGINX does the comparison not URL encoded, so if you have a URL like “/images/%20/test” then use “/images/ /test” to determine the location.
    而且它重要在于 NGINX 做比較沒有 URL 編碼,所以如果你有一個 URL 鏈接’/images/%20/test’ , 那么使用 “images/ /test” 限定location。

    To summarize, the order in which directives are checked is as follows:
    總結,指令按下列順序被接受:

    1. Directives with the = prefix that match the query exactly. If found, searching stops.
    1. = 前綴的指令嚴格匹配這個查詢。如果找到,停止搜索。
    2. All remaining directives with conventional strings, longest match first. If this match used the ^~ prefix, searching stops.
    2. 剩下的常規字符串,長的在前。如果這個匹配使用 ^~ 前綴,搜索停止。
    3. Regular expressions, in order of definition in the configuration file.
    3. 正則表達式,按配置文件里的順序。
    4. If #3 yielded a match, that result is used. Else the match from #2 is used.
    4. 如果第三步產生匹配,則使用這個結果。否則使用第二步的匹配結果。

    Example:
    例子:

    location = / {
    # matches the query / only.
    # 只匹配 / 查詢。
    [ configuration A ]
    }
    location / {
    # matches any query, since all queries begin with /, but regular
    # expressions and any longer conventional blocks will be
    # matched first.
    # 匹配任何查詢,因為所有請求都已 / 開頭。但是正則表達式規則和長的塊規則將被優先和查詢匹配。
    [ configuration B ]
    }
    location ^~ /images/ {
    # matches any query beginning with /images/ and halts searching,
    # so regular expressions will not be checked.
    # 匹配任何已 /images/ 開頭的任何查詢并且停止搜索。任何正則表達式將不會被測試。
    [ configuration C ]
    }
    location ~* “.(gif|jpg|jpeg)$ {
    # matches any request ending in gif, jpg, or jpeg. However, all
    # requests to the /images/ directory will be handled by
    # Configuration C.
    # 匹配任何已 gif、jpg 或 jpeg 結尾的請求。然而所有 /images/ 目錄的請求將使用 Configuration C。
    [ configuration D ]
    }

    Example requests:
    例子請求:

    *

    / -> configuration A
    *

    /documents/document.html -> configuration B
    *

    /images/1.gif -> configuration C
    *

    /documents/1.jpg -> configuration D

    Note that you could define these 4 configurations in any order and the results would remain the same.
    注意:按任意順序定義這4個配置結果將仍然一樣。

    一、介紹Nginx是俄羅斯人編寫的十分輕量級的HTTP服務器,Nginx,它的發音為“engine X”, 是一個高性能的HTTP和反向代理服務器,同時也是一個IMAP/POP3/SMTP 代理服務器.
    二、Location語法語法:location [=|~|~*|^~] /uri/ { … }
    注:
    1、~   為區分大小寫匹配
    2、~* 為不區分大小寫匹配
    3、!~和!~*分別為區分大小寫不匹配及不區分大小寫
    不匹配
    示例一:
    location  / {
    }
    匹配任何查詢,因為所有請求都以 / 開頭。但是正則表達式規則將被優先和查詢匹配。
    示例二:
    location =/ {}
    僅僅匹配/

    示例三:
    location ~* \.(gif|jpg|jpeg)$ {
    rewrite \.(gif|jpg)$ /logo.png;

    注:不區分大小寫匹配任何以gif,jpg,jpeg結尾的文件

    三、ReWrite語法
    last – 基本上都用這個Flag。
    break – 中止Rewirte,不在繼續匹配
    redirect – 返回臨時重定向的HTTP狀態302
    permanent – 返回永久重定向的HTTP狀態301

    1、下面是可以用來判斷的表達式:
    -f和!-f用來判斷是否存在文件
    -d和!-d用來判斷是否存在目錄
    -e和!-e用來判斷是否存在文件或目錄
    -x和!-x用來判斷文件是否可執行
    2、下面是可以用作判斷的全局變量
    例:http://localhost:88/test1/test2/test.php
    $host:localhost
    $server_port:88
    $request_uri:
    http://localhost:88/test1/test2/test.php
    $document_uri:/test1/test2/test.php
    $document_root:D:\nginx/html
    $request_filename:D:\nginx/html/test1/test2/test.php

    四、Redirect語法
    server {
    listen 80;
    server_name start.igrow.cn;
    index index.html index.php;
    root html;
    if ($http_host !~ “^star\.igrow\.cn

    正則表達式匹配,其中:

    1. * ~ 為區分大小寫匹配
    2. * ~* 為不區分大小寫匹配
    3. * !~和!~*分別為區分大小寫不匹配及不區分大小寫不匹配

    文件及目錄匹配,其中:

    1. * -f和!-f用來判斷是否存在文件
    2. * -d和!-d用來判斷是否存在目錄
    3. * -e和!-e用來判斷是否存在文件或目錄
    4. * -x和!-x用來判斷文件是否可執行

    flag標記有:

    1. * last 相當于Apache里的[L]標記,表示完成rewrite
    2. * break 終止匹配, 不再匹配后面的規則
    3. * redirect 返回302臨時重定向 地址欄會顯示跳轉后的地址
    4. * permanent 返回301永久重定向 地址欄會顯示跳轉后的地址

    一些可用的全局變量有,可以用做條件判斷(待補全)

    1. $args
    2. $content_length
    3. $content_type
    4. $document_root
    5. $document_uri
    6. $host
    7. $http_user_agent
    8. $http_cookie
    9. $limit_rate
    10. $request_body_file
    11. $request_method
    12. $remote_addr
    13. $remote_port
    14. $remote_user
    15. $request_filename
    16. $request_uri
    17. $query_string
    18. $scheme
    19. $server_protocol
    20. $server_addr
    21. $server_name
    22. $server_port
    23. $uri

    結合QeePHP的例子

    1. if (!-d $request_filename) {
    2. rewrite ^/([a-z-A-Z]+)/([a-z-A-Z]+)/?(.*)$ /index.php?namespace=user&amp;controller=$1&amp;action=$2&amp;$3 last;
    3. rewrite ^/([a-z-A-Z]+)/?$ /index.php?namespace=user&amp;controller=$1 last;
    4. break;

    多目錄轉成參數
    abc.domian.com/sort/2 => abc.domian.com/index.php?act=sort&name=abc&id=2

    1. if ($host ~* (.*)\.domain\.com) {
    2. set $sub_name $1;
    3. rewrite ^/sort\/(\d+)\/?$ /index.php?act=sort&cid=$sub_name&id=$1 last;
    4. }

    目錄對換
    /123456/xxxx -> /xxxx?id=123456

    1. rewrite ^/(\d+)/(.+)/ /$2?id=$1 last;

    例如下面設定nginx在用戶使用ie的使用重定向到/nginx-ie目錄下:

    1. if ($http_user_agent ~ MSIE) {
    2. rewrite ^(.*)$ /nginx-ie/$1 break;
    3. }

    目錄自動加“/”

    1. if (-d $request_filename){
    2. rewrite ^/(.*)([^/])$ http://$host/$1$2/ permanent;
    3. }

    禁止htaccess

    1. location ~/\.ht {
    2. deny all;
    3. }

    禁止多個目錄

    1. location ~ ^/(cron|templates)/ {
    2. deny all;
    3. break;
    4. }

    禁止以/data開頭的文件
    可以禁止/data/下多級目錄下.log.txt等請求;

    1. location ~ ^/data {
    2. deny all;
    3. }

    禁止單個目錄
    不能禁止.log.txt能請求

    1. location /searchword/cron/ {
    2. deny all;
    3. }

    禁止單個文件

    1. location ~ /data/sql/data.sql {
    2. deny all;
    3. }

    給favicon.ico和robots.txt設置過期時間;
    這里為favicon.ico為99天,robots.txt為7天并不記錄404錯誤日志

    1. location ~(favicon.ico) {
    2. log_not_found off;
    3. expires 99d;
    4. break;
    5. }

    6. location ~(robots.txt) {
    7. log_not_found off;
    8. expires 7d;
    9. break;
    10. }

    設定某個文件的過期時間;這里為600秒,并不記錄訪問日志

    1. location ^~ /html/scripts/loadhead_1.js {
    2. access_log off;
    3. root /opt/lampp/htdocs/web;
    4. expires 600;
    5. break;
    6. }

    文件反盜鏈并設置過期時間
    這里的return 412 為自定義的http狀態碼,默認為403,方便找出正確的盜鏈的請求
    “rewrite ^/ http://leech.c1gstudio.com/leech.gif;”顯示一張防盜鏈圖片
    “access_log off;”不記錄訪問日志,減輕壓力
    “expires 3d”所有文件3天的瀏覽器緩存

    1. location ~* ^.+\.(jpg|jpeg|gif|png|swf|rar|zip|css|js)$ {
    2. valid_referers none blocked *.c1gstudio.com *.c1gstudio.net localhost 208.97.167.194;
    3. if ($invalid_referer) {
    4. rewrite ^/ http://leech.c1gstudio.com/leech.gif;
    5. return 412;
    6. break;
    7. }
    8. access_log off;
    9. root /opt/lampp/htdocs/web;
    10. expires 3d;
    11. break;
    12. }

    只充許固定ip訪問網站,并加上密碼

    1. root /opt/htdocs/www;
    2. allow 208.97.167.194;
    3. allow 222.33.1.2;
    4. allow 231.152.49.4;
    5. deny all;
    6. auth_basic “C1G_ADMIN”;
    7. auth_basic_user_file htpasswd;

    將多級目錄下的文件轉成一個文件,增強seo效果
    /job-123-456-789.html 指向/job/123/456/789.html

    1. rewrite ^/job-([0-9]+)-([0-9]+)-([0-9]+)\.html$ /job/$1/$2/jobshow_$3.html last;

    將根目錄下某個文件夾指向2級目錄
    如/shanghaijob/ 指向 /area/shanghai/
    如果你將last改成permanent,那么瀏覽器地址欄顯是/location/shanghai/

    1. rewrite ^/([0-9a-z]+)job/(.*)$ /area/$1/$2 last;

    上面例子有個問題是訪問/shanghai 時將不會匹配

    1. rewrite ^/([0-9a-z]+)job$ /area/$1/ last;
    2. rewrite ^/([0-9a-z]+)job/(.*)$ /area/$1/$2 last;

    這樣/shanghai 也可以訪問了,但頁面中的相對鏈接無法使用,
    如./list_1.html真實地址是/area/shanghia/list_1.html會變成/list_1.html,導至無法訪問。

    那我加上自動跳轉也是不行咯
    (-d $request_filename)它有個條件是必需為真實目錄,而我的rewrite不是的,所以沒有效果

    1. if (-d $request_filename){
    2. rewrite ^/(.*)([^/])$ http://$host/$1$2/ permanent;
    3. }

    知道原因后就好辦了,讓我手動跳轉吧

    1. rewrite ^/([0-9a-z]+)job$ /$1job/ permanent;
    2. rewrite ^/([0-9a-z]+)job/(.*)$ /area/$1/$2 last;

    文件和目錄不存在的時候重定向:

    1. if (!-e $request_filename) {
    2. proxy_pass http://127.0.0.1;
    3. }

    域名跳轉

    1. server
    2. {
    3. listen 80;
    4. server_name jump.c1gstudio.com;
    5. index index.html index.htm index.php;
    6. root /opt/lampp/htdocs/www;
    7. rewrite ^/ http://www.c1gstudio.com/;
    8. access_log off;
    9. }

    多域名轉向

    1. server_name www.c1gstudio.com www.c1gstudio.net;
    2. index index.html index.htm index.php;
    3. root /opt/lampp/htdocs;
    4. if ($host ~ “c1gstudio\.net”) {
    5. rewrite ^(.*) http://www.c1gstudio.com$1 permanent;
    6. }

    三級域名跳轉

    1. if ($http_host ~* “^(.*)\.i\.c1gstudio\.com$”) {
    2. rewrite ^(.*) http://top.yingjiesheng.com$1;
    3. break;
    4. }

    域名鏡向

    1. server
    2. {
    3. listen 80;
    4. server_name mirror.c1gstudio.com;
    5. index index.html index.htm index.php;
    6. root /opt/lampp/htdocs/www;
    7. rewrite ^/(.*) http://www.c1gstudio.com/$1 last;
    8. access_log off;
    9. }

    某個子目錄作鏡向

    1. location ^~ /zhaopinhui {
    2. rewrite ^.+ http://zph.c1gstudio.com/ last;
    3. break;
    4. }

    discuz ucenter home (uchome) rewrite

    1. rewrite ^/(space|network)-(.+)\.html$ /$1.php?rewrite=$2 last;
    2. rewrite ^/(space|network)\.html$ /$1.php last;
    3. rewrite ^/([0-9]+)$ /space.php?uid=$1 last;

    discuz 7 rewrite

    1. rewrite ^(.*)/archiver/((fid|tid)-[\w\-]+\.html)$ $1/archiver/index.php?$2 last;
    2. rewrite ^(.*)/forum-([0-9]+)-([0-9]+)\.html$ $1/forumdisplay.php?fid=$2&page=$3 last;
    3. rewrite ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/viewthread.php?tid=$2&extra=page\%3D$4&page=$3 last;
    4. rewrite ^(.*)/profile-(username|uid)-(.+)\.html$ $1/viewpro.php?$2=$3 last;
    5. rewrite ^(.*)/space-(username|uid)-(.+)\.html$ $1/space.php?$2=$3 last;
    6. rewrite ^(.*)/tag-(.+)\.html$ $1/tag.php?name=$2 last;

    給discuz某版塊單獨配置域名

    1. server_name bbs.c1gstudio.com news.c1gstudio.com;

    2. location = / {
    3. if ($http_host ~ news\.c1gstudio.com$) {
    4. rewrite ^.+ http://news.c1gstudio.com/forum-831-1.html last;
    5. break;
    6. }
    7. }

    discuz ucenter 頭像 rewrite 優化

    1. location ^~ /ucenter {
    2. location ~ .*\.php?$
    3. {
    4. #fastcgi_pass unix:/tmp/php-cgi.sock;
    5. fastcgi_pass 127.0.0.1:9000;
    6. fastcgi_index index.php;
    7. include fcgi.conf;
    8. }

    9. location /ucenter/data/avatar {
    10. log_not_found off;
    11. access_log off;
    12. location ~ /(.*)_big\.jpg$ {
    13. error_page 404 /ucenter/images/noavatar_big.gif;
    14. }
    15. location ~ /(.*)_middle\.jpg$ {
    16. error_page 404 /ucenter/images/noavatar_middle.gif;
    17. }
    18. location ~ /(.*)_small\.jpg$ {
    19. error_page 404 /ucenter/images/noavatar_small.gif;
    20. }
    21. expires 300;
    22. break;
    23. }
    24. }

    jspace rewrite

    1. location ~ .*\.php?$
    2. {
    3. #fastcgi_pass unix:/tmp/php-cgi.sock;
    4. fastcgi_pass 127.0.0.1:9000;
    5. fastcgi_index index.php;
    6. include fcgi.conf;
    7. }

    8. location ~* ^/index.php/
    9. {
    10. rewrite ^/index.php/(.*) /index.php?$1 break;
    11. fastcgi_pass 127.0.0.1:9000;
    12. fastcgi_index index.php;
    13. include fcgi.conf;
    14. }

    amp;quot {
    rewrite ^(.*)
    http://star.igrow.cn$1 redirect;
    }
    }

    五、防盜鏈location ~* \.(gif|jpg|swf)$ {
    valid_referers none blocked start.igrow.cn sta.igrow.cn;
    if ($invalid_referer) {
    rewrite ^/
    http://$host/logo.png;
    }
    }

    六、根據文件類型設置過期時間
    location ~* \.(js|css|jpg|jpeg|gif|png|swf)$ {
    if (-f $request_filename) {
    expires    1h;
    break;
    }
    }

    七、禁止訪問某個目錄
    location ~* \.(txt|doc)${
    root /data/www/wwwroot/linuxtone/test;
    deny all;
    }

    XX

    Posted in linux

    Tags:

    You can leave a response , or trackback from your own site.

    Advertisement

    Leave a Reply

    November 12th, 2010 by admin Leave a reply » 站長統計
    posted @ 2011-12-12 22:25 ivaneeo 閱讀(4170) | 評論 (0)編輯 收藏

    先用現成的組件玩一下,一會再去看看組件源碼研究一下。

    http://code.google.com/p/flex-iframe/

    下載了flexiframe.swc,引入工程。

    flex代碼

    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="    layout="absolute"
        xmlns:code="
     <mx:Panel width="500"
         height="400">

      <code:IFrame id="googleIFrame"
          label="Google"
          source="
          width="100%"
          height="100%"/>
     </mx:Panel>

    </mx:Application>

    運行,發現,可以了。

     

    不過,有個問題,鼠標點擊別處的時候,網頁消失了。

    找了很多地方,找到了解決方法。設置wmode。

    首先了解一下wmode是什么。

    window mode(wmode)

    wmode即窗口模式總共有三種:

    window 模式

    默認情況下的顯示模式,在這種模式下flash player有自己的窗口句柄,這就意味著flash影片是存在于Windows中的一個顯示實例,并且是在瀏覽器核心顯示窗口之上的,所以flash只 是貌似顯示在瀏覽器中,但這也是flash最快最有效率的渲染模式。由于他是獨立于瀏覽器的HTML渲染表面,這就導致默認顯示方式下flash總是會遮 住位置與他重合的所有DHTML層。

    但是大多數蘋果電腦瀏覽器會允許DHTML層顯示在flash之上,但當flash影片播放時會出現比較詭異的現象,比如DHTML層像被flash刮掉一塊一樣顯示異常。

    Opaque 模式

    這 是一種無窗口模式,在這種情況下flash player沒有自己的窗口句柄,這就需要瀏覽器需要告訴flash player在瀏覽器的渲染表面繪制的時間和位置。這時flash影片就不會在高于瀏覽器HTML渲染表面而是與其他元素一樣在同一個頁面上,因此你就可 以使用z-index值來控制DHTML元素是遮蓋flash或者被遮蓋。

    Transparent 模式

    透明模式, 在這種模式下flash player會將stage的背景色alpha值將為0并且只會繪制stage上真實可見的對象,同樣你也可以使用z-index來控制flash影片的 深度值,但是與Opaque模式不同的是這樣做會降低flash影片的回放效果,而且在9.0.115之前的flash player版本設置wmode=”opaque”或”transparent”會導致全屏模式失效。

     

    這邊,我們將wmode設置為transparent。

    我直接修改了工程的html模板,紅色字體部分為新增加的代碼。

    if ( hasProductInstall && !hasRequestedVersion ) {
     // DO NOT MODIFY THE FOLLOWING FOUR LINES
     // Location visited after installation is complete if installation is required
     var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn";
     var MMredirectURL = window.location;
        document.title = document.title.slice(0, 47) + " - Flash Player Installation";
        var MMdoctitle = document.title;

     AC_FL_RunContent(
      "src", "playerProductInstall",
      "FlashVars", "MMredirectURL="+MMredirectURL+'&MMplayerType='+MMPlayerType+'&MMdoctitle='+MMdoctitle+"",
      "width", "${width}",
      "height", "${height}",
      "align", "middle",
      "id", "${application}",
      "quality", "high",
      "bgcolor", "${bgcolor}",
      "name", "${application}",
      "allowScriptAccess","sameDomain",
      "type", "application/x-shockwave-flash",
      "pluginspage", "
      "wmode","transparent"
     );
    } else if (hasRequestedVersion) {
     // if we've detected an acceptable version
     // embed the Flash Content SWF when all tests are passed
     AC_FL_RunContent(
       "src", "${swf}",
       "width", "${width}",
       "height", "${height}",
       "align", "middle",
       "id", "${application}",
       "quality", "high",
       "bgcolor", "${bgcolor}",
       "name", "${application}",
       "allowScriptAccess","sameDomain",
       "type", "application/x-shockwave-flash",
       "pluginspage", "
       "wmode","transparent"
     );
      } else {  // flash is too old or we can't detect the plugin
        var alternateContent = 'Alternate HTML content should be placed here. '
       + 'This content requires the Adobe Flash Player. '
        + '<a href=http://www.adobe.com/go/getflash/>Get Flash</a>';
        document.write(alternateContent);  // insert non-flash content
      }

     

       <embed src="${swf}.swf" quality="high" bgcolor="${bgcolor}"
        width="${width}" height="${height}" name="${application}" align="center"
        play="true"
        loop="false"
        quality="high"
        allowScriptAccess="sameDomain"
        type="application/x-shockwave-flash"
        pluginspage="
        wmode="transparent">
       </embed>

     

    保存,運行。問題解決了。


    restrict限制的意思

    1. 限制某個字符的輸入,用符號 ^ 跟上要限制的字符,可跟多個字符 

          <!-- 限制字符"~"的輸入 --> 

          <mx:TextInput id="xxx"  restrict="^~" /> 

          <!-- 限制字符"ab"的輸入 --> 

          <mx:TextInput id="xxx"  restrict="^ab" /> 

    2. 設置只能輸入某些字符,將允許輸入的字符羅列出來即可,也可以用 - 組合表示字符范圍 

          <!-- 只能輸入abc --> 

          <mx:TextInput id="xxx"  restrict="abc" /> 

          <!-- 只能輸入小寫字母 --> 

          <mx:TextInput id="xxx"  restrict="a-z" /> 

          <!-- 只能輸入小寫字母、大寫字母和數字 --> 

          <mx:TextInput id="xxx"  restrict="a-zA-Z0-9" /> 

    3. 組合使用 

          <!-- 只能輸入數字和符號"." --> 

          <mx:TextInput id="xxx"  restrict="0-9." /> 

          <!-- 只能輸入除ab之外的小寫字母 --> 

          <mx:TextInput id="xxx"  restrict="a-z^ab" /> 
     

    下面羅列出了一些常用的正則表達式:

    ^/d+$  //匹配非負整數(正整數 + 0)
    ^[0-9]*[1-9][0-9]*$  //匹配正整數
    ^((-/d+)|(0+))$  //匹配非正整數(負整數 + 0)
    ^-[0-9]*[1-9][0-9]*$  //匹配負整數
    ^-?/d+$    //匹配整數
    ^/d+(/./d+)?$  //匹配非負浮點數(正浮點數 + 0)
    ^(([0-9]+/.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*/.[0-9]+)|([0-9]*[1-9][0-9]*))$  //匹配正浮點數
    ^((-/d+(/./d+)?)|(0+(/.0+)?))$  //匹配非正浮點數(負浮點數 + 0)
    ^(-(([0-9]+/.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*/.[0-9]+)|([0-9]*[1-9][0-9]*)))$  //匹配負浮點數
    ^(-?/d+)(/./d+)?$  //匹配浮點數
    ^[A-Za-z]+$  //匹配由26個英文字母組成的字符串
    ^[A-Z]+$  //匹配由26個英文字母的大寫組成的字符串
    ^[a-z]+$  //匹配由26個英文字母的小寫組成的字符串
    ^[A-Za-z0-9]+$  //匹配由數字和26個英文字母組成的字符串
    ^/w+$  //匹配由數字、26個英文字母或者下劃線組成的字符串
    ^[/w-]+(/.[/w-]+)*@[/w-]+(/.[/w-]+)+$    //匹配email地址
    ^[a-zA-z]+://匹配(/w+(-/w+)*)(/.(/w+(-/w+)*))*(/?/S*)?$  //匹配url

    匹配中文字符的正則表達式: [/u4e00-/u9fa5]
    匹配雙字節字符(包括漢字在內):[^/x00-/xff]
    匹配空行的正則表達式:/n[/s| ]*/r
    匹配HTML標記的正則表達式:/<(.*)>.*<//>|<(.*) //>/
    匹配首尾空格的正則表達式:(^/s*)|(/s*$)
    匹配Email地址的正則表達式:/w+([-+.]/w+)*@/w+([-.]/w+)*/./w+([-.]/w+)*
    匹配網址URL的正則表達式:^[a-zA-z]+://(/w+(-/w+)*)(/.(/w+(-/w+)*))*(/?/S*)?$
    匹配帳號是否合法(字母開頭,允許5-16字節,允許字母數字下劃線):^[a-zA-Z][a-zA-Z0-9_]{4,15}$
    匹配國內電話號碼:(/d{3}-|/d{4}-)?(/d{8}|/d{7})?
    匹配騰訊QQ號:^[1-9]*[1-9][0-9]*$
    下表是元字符及其在正則表達式上下文中的行為的一個完整列表:
    / 將下一個字符標記為一個特殊字符、或一個原義字符、或一個后向引用、或一個八進制轉義符。
    ^ 匹配輸入字符串的開始位置。如果設置了 RegExp 對象的Multiline 屬性,^ 也匹配 ’/n’ 或 ’/r’ 之后的位置。
    $ 匹配輸入字符串的結束位置。如果設置了 RegExp 對象的Multiline 屬性,$ 也匹配 ’/n’ 或 ’/r’ 之前的位置。
    * 匹配前面的子表達式零次或多次。
    + 匹配前面的子表達式一次或多次。+ 等價于 {1,}。
    ? 匹配前面的子表達式零次或一次。? 等價于 {0,1}。
    {n} n 是一個非負整數,匹配確定的n 次。
    {n,} n 是一個非負整數,至少匹配n 次。
    {n,m} m 和 n 均為非負整數,其中n <= m。最少匹配 n 次且最多匹配 m 次。在逗號和兩個數之間不能有空格。
    ? 當該字符緊跟在任何一個其他限制符 (*, +, ?, {n}, {n,}, {n,m}) 后面時,匹配模式是非貪婪的。非貪婪模式盡可能少的匹配所搜索的字符串,而默認的貪婪模式則盡可能多的匹配所搜索的字符串。
    . 匹配除 “/n” 之外的任何單個字符。要匹配包括 ’/n’ 在內的任何字符,請使用象 ’[./n]’ 的模式。
    (pattern) 匹配pattern 并獲取這一匹配。
    (?:pattern) 匹配pattern 但不獲取匹配結果,也就是說這是一個非獲取匹配,不進行存儲供以后使用。
    x|y 匹配 x 或 y。
    [xyz] 字符集合。
    [^xyz] 負值字符集合。
    [a-z] 字符范圍,匹配指定范圍內的任意字符。
    [^a-z] 負值字符范圍,匹配任何不在指定范圍內的任意字符。
    /b 匹配一個單詞邊界,也就是指單詞和空格間的位置。
    /B 匹配非單詞邊界。
    /cx 匹配由x指明的控制字符。
    /d 匹配一個數字字符。等價于 [0-9]。

    /D 匹配一個非數字字符。等價于 [^0-9]。
    /f 匹配一個換頁符。等價于 /x0c 和 /cL。
    /n 匹配一個換行符。等價于 /x0a 和 /cJ。
    /r 匹配一個回車符。等價于 /x0d 和 /cM。
    /s 匹配任何空白字符,包括空格、制表符、換頁符等等。等價于[ /f/n/r/t/v]。
    /S 匹配任何非空白字符。等價于 [^ /f/n/r/t/v]。
    /t 匹配一個制表符。等價于 /x09 和 /cI。
    /v 匹配一個垂直制表符。等價于 /x0b 和 /cK。
    /w 匹配包括下劃線的任何單詞字符。等價于’[A-Za-z0-9_]’。
    /W 匹配任何非單詞字符。等價于 ’[^A-Za-z0-9_]’。
    /xn 匹配 n,其中 n 為十六進制轉義值。十六進制轉義值必須為確定的兩個數字長。
    /num 匹配 num,其中num是一個正整數。對所獲取的匹配的引用。
    /n 標識一個八進制轉義值或一個后向引用。如果 /n 之前至少 n 個獲取的子表達式,則 n 為后向引用。否則,如果 n 為八進制數字 (0-7),則 n 為一個八進制轉義值。
    /nm 標識一個八進制轉義值或一個后向引用。如果 /nm 之前至少有is preceded by at least nm 個獲取得子表達式,則 nm 為后向引用。如果 /nm 之前至少有 n 個獲取,則 n 為一個后跟文字 m 的后向引用。如果前面的條件都不滿足,若 n 和 m 均為八進制數字 (0-7),則 /nm 將匹配八進制轉義值 nm。

    posted @ 2011-11-21 18:24 ivaneeo 閱讀(3109) | 評論 (0)編輯 收藏

    眾所周知Flex主要用于B/S結構程序的開發,凡是這類型的開發都存在頁面間的傳值的問題,通常一般的B/S開發主要不外乎使用地址修改法,隱藏表單域等方法,但是這些方法在Flex中確沒有用,原因是應為Flex支持的模型和普通的B/S開發語言不一樣,一般的B/S開發語言使用的主要是請求/響應模型,而Flex采用的是事件驅動模型(這種模型主要見于C/S結構程序),所以我們的Form表單等傳值方法就無效了,哪么我們如何在兩個這樣模型的頁面中傳遞數據呢?下面我們講述下兩種常用的傳值方法:
    一、 利用ExternalInterface調用Javascript
    a) 該方法主要利用ExternalInterface的call方法調用Javascript函數,進而修改地址(有點類似于地址修改法),在接受頁面上主要是靠BrowserManager獲取地址欄信息,并利用URLUtil截取參數。
    b) 該方法雖然簡單但是確調用了2種語言,給編寫帶來一定的困難
    發送頁面代碼(second.html):
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
     <mx:Script>
      <![CDATA[
      function kk():void{
       var val:String = myparam.text;
     ExternalInterface.call("function(){window.location.href='http://localhost:8080/send/page.html#param1="+val+"'}");  }
      ]]>
     </mx:Script>
     <mx:TextInput  id="myparam"></mx:TextInput>
     <mx:Button name="ok" click="kk()" x="185" label="提交"></mx:Button>
    </mx:Application>
    接收頁面代碼(page.html):
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()" >
     <mx:Script>
      <![CDATA[
       import mx.managers.IBrowserManager;
       import mx.managers.BrowserManager;
       import mx.utils.URLUtil;
       [Bindable]
       var param:String;
       function init():void
       {
        var bm:IBrowserManager = BrowserManager.getInstance(); 
        bm.init();
        var o:Object = URLUtil.stringToObject(bm.fragment,"&");
        param = o.param1;
       }
      ]]>
     </mx:Script>
     <mx:TextInput id="val" text="{param}">
     </mx:TextInput>
    </mx:Application>
    二、 利用SharedObject(本地共享對象傳送)
    a) 該對象類似于Cookie,將需要傳送的數據放在SharedObject對象中,而實際上在本機大致在(win2k和 win xp中,默認路徑為C:/Documents and Settings/username/Application Data/Macromedia/Flash Player/#SharedObjects (username為機器的用戶名))位置生成一個sol文件,該對象具有一個data屬性,只要將你要傳的數據按鍵值對放進去就好了,下次讀取的時候就在本地直接讀取即可
    b) 遺憾的是,該對象要求你自己創建還要自己清除,并且在寫入數據時一定要強制刷新,否則數據無法希爾
    發送頁面代碼(index.html):
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
     <mx:Script>
      <![CDATA[
       function s mit():void
       {
        var param:String = myparam.text;
        //創建全局SharedObject,如果不用全局就去掉后面的"/",一旦去掉那么cookie只能被自己的Application使用,其他Applicaiton無法看見
        //myparam是要求在本機創建一個叫cookie.sol的文件
        var obj:SharedObject = SharedObject.getLocal("cookie","/");
        obj.data.username=myparam.text;
        obj.flush();
        //調用URLReqst將跳轉到second.html頁面
        var reqst:URLReqst =new URLReqst();
        reqst.url="second.html";
        navigateToURL(reqst);
       }
      ]]>
     </mx:Script>
     <mx:TextInput id="myparam"></mx:TextInput>
     <mx:Button label="提交" click="s mit()" x="177"></mx:Button>
    </mx:Application>
    接收頁面代碼(second.html):
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()">
     <mx:Script>
      <![CDATA[
       [Bindable]
       var param:String;
       function init():void
       {
        //在本地找到myparam.sol文件
        var obj:SharedObject =SharedObject.getLocal("cookie","/");
        //讀取前頁存入的數據
        param = obj.data.username;
        //用完了別忘了將myparam.sol文件刪除
        obj.clear();
       }
      ]]>
     </mx:Script>
     <mx:TextInput id="mypar" text="{param}"></mx:TextInput>
    </mx:Application>


    posted @ 2011-10-21 16:32 ivaneeo 閱讀(517) | 評論 (0)編輯 收藏

    參數輸入進程號...
    #!/bin/bash

        if [ -z $1 ]
        then
            echo "Need a pid argument"
            exit 1
        fi

        if [ -d /proc/$1 ];then
            exit 0
        else
            exit 1
        fi

    posted @ 2011-10-20 16:06 ivaneeo 閱讀(361) | 評論 (0)編輯 收藏

    nc -vv -w 2 -z vm-node10 22
    ID=$?
    echo $ID

    1為失敗、0為成功
    posted @ 2011-10-20 16:04 ivaneeo 閱讀(277) | 評論 (0)編輯 收藏

    首先把自己的腳本放到/etc/init.d中,,然后執行如下指令:

    update-rc.d a start 90 2 3 4 5 . stop 90 0 1 6 .

    其中a就是你的腳本,注意有兩個點。

    a腳本范例。

     

    #!/bin/sh


    # Source function library.
    if [ -f /etc/init.d/functions ]; then
        . /etc/init.d/functions
    else
        . /lib/lsb/init-functions
    fi

    MOD=/a.ko

    start() 
    {
            echo -n $"insert a kernel module: "
        /sbin/insmod $MOD
            echo
    }

    stop() 
    {
            echo -n $"remove a kernel module: "
            /sbin/rmmod a -f
            echo
    }

    [ -f $MOD ] || exit 0

    # See how we were called.
    case "$1" in
      start)
        start
            ;;
      stop)
        stop
            ;;
      restart|reload)
        stop
        start
        ;;
      *)
         echo $"Usage: $0 {start|stop|restart|reload}"

     

     

    update-rc.d命令,是用來自動的升級System V類型初始化腳本,簡單的講就是,哪些東西是你想要系統在引導初始化的時候運行的,哪些是希望在關機或重啟時停止的,可以用它來幫你設置。這些腳本的連接 位于/etc/rcn.d/LnName,對應腳本位于/etc/init.d/Script-name.

    1、設置指定啟動順序、指定運行級別的啟動項:
    update-rc.d <service> start <order> <runlevels>
    2、設置在指定運行級中,按指定順序停止:
    update-rc.d <service> stop <order> <runlevels>
    3、從所有的運行級別中刪除指定的啟動項:
    update-rc.d -f <script-name> remove

    例如:
    update-rc.d script-name start 90 1 2 3 4 5 . stop 52 0 6 .
    start 90 1 2 3 4 5 . : 表示在1、2、3、4、5這五個運行級別中,按先后順序,由小到大,第90個開始運行這個腳本。
    stop 52 0 6 . :表示在0、6這兩個運行級別中,按照先后順序,由小到大,第52個停止這個腳本的運行。

     

     

    如果在 /etc/init.d 中加入一個 script,還須要制作相關的 link
    在 /etc/rc*.d 中。K 開頭是 kill , S 開頭是 start , 數字順序代表啟動的順序。(SysV)

    update-rc.d 可以幫你的忙。

    例:

    在 /etc/init.d 中建立一個叫作 zope 的 script , 然后

    update-rc.d zope defaults

    就會產生以下鏈結::

    Adding system startup for /etc/init.d/zope ...
    /etc/rc0.d/K20zope -> ../init.d/zope
    /etc/rc1.d/K20zope -> ../init.d/zope
    /etc/rc6.d/K20zope -> ../init.d/zope
    /etc/rc2.d/S20zope -> ../init.d/zope
    /etc/rc3.d/S20zope -> ../init.d/zope
    /etc/rc4.d/S20zope -> ../init.d/zope
    /etc/rc5.d/S20zope -> ../init.d/zope

    其他進階使用方式請 man update-rc.d

    posted @ 2011-10-20 14:56 ivaneeo 閱讀(1450) | 評論 (0)編輯 收藏

    僅列出標題
    共67頁: First 上一頁 10 11 12 13 14 15 16 17 18 下一頁 Last 
    主站蜘蛛池模板: 日本一道本高清免费| 亚洲日韩精品无码专区网址| 免费人成网上在线观看| 亚洲人成影院在线无码按摩店| 国产精品免费高清在线观看| 国产精品久久亚洲不卡动漫| www亚洲精品少妇裸乳一区二区 | 日韩精品人妻系列无码专区免费| 亚洲欧洲另类春色校园网站| 亚洲精品视频免费| 国产免费不卡视频| 春意影院午夜爽爽爽免费| 少妇中文字幕乱码亚洲影视| 国产在线播放免费| 69视频免费在线观看| 黄色一级视频免费| 亚洲精品91在线| 亚洲伦乱亚洲h视频| 亚洲天堂免费在线| 两个人看的www免费| 亚洲狠狠婷婷综合久久蜜芽| 亚洲av伊人久久综合密臀性色 | 人妻视频一区二区三区免费| 两性色午夜免费视频| 亚洲人成电影网站免费| 亚洲va久久久噜噜噜久久狠狠| 最好免费观看韩国+日本 | 毛片免费视频观看| 99在线免费视频| 麻豆亚洲AV成人无码久久精品 | 男女免费观看在线爽爽爽视频| 中文字幕免费在线播放| 色综合久久精品亚洲国产| 亚洲最大在线观看| 亚洲情XO亚洲色XO无码| 免费人成网站在线高清 | 日韩亚洲Av人人夜夜澡人人爽 | 午夜一区二区免费视频| 亚洲精品视频免费看| 免费人成黄页在线观看日本| 一区二区三区免费电影|