知識分享

因為找資料很辛苦,特此整理一下

官方文件-目錄:http://nginx.org/en/docs/index.html

官方文件-核心模組說明:http://nginx.org/cn/docs/http/ngx_http_core_module.html

官方文件-https設置說明:http://nginx.org/en/docs/http/configuring_https_servers.html

NGINX 的 location 语法规则

更多

因為不常用,筆記一下,因為花了2個小時的生命找答案。
參考自這篇:https://www.drupal.org/node/2079561

1.首先要先安裝 Cache Expireation 這個模組,安裝後基本設定值如下:

2.設定HTTPRL,如下圖

3.打完收工

本文參考:

http://www.leanderlindahl.se/en/article/adding-apple-touch-icons-to-your...
http://drupal.stackexchange.com/questions/34845/how-to-implement-apple-t...

這個apple-touch-icon.png 主要的用途是方便蘋果行動裝置的愛用者,如果要把某個網站加到手機的主畫面用時,用來作為按鈕的圖示。

下面這個網站,則可以幫你製作所需要的各種尺寸的按鈕圖示。

http://iconifier.net/index.php

要統計某目錄底下的檔案數或目錄數,需要結合兩個指令 - find 及 wc

指令格式

find [obj_directory] [-type f] [-name filename] |wc [-l]

 

find參數說明:

obj_directory:要搜尋的目錄名稱
-type:要搜尋的類型,f=檔案,d=目錄
-name:後面接檔名,可加萬用字元(*),搜尋類似檔名的檔案

 

wc參數說明:

-c: 統計位元組數
-l:統計行數
-m:統計字元數。不能與 -c 一起使用。
-w 統計字數。一個字被定義為由空白、跳格或換行字元分隔的字串。
-L 列印最長行的長度。
-help 顯示説明資訊。

 

統計目前目錄底下所有的檔案總數:

 find ./ -type f -name *.*| wc -l

更多

本系列文章源於 Drupal.org ─ Caching: Modules that make Drupal scale

以下僅列出 支援 Drupal 7 的模組

模組快取類型效能提昇影響訪客伺服器類型文件

Boost

.htaccess bypass非常高匿名訪客
更多

指令如下:

lsb_release -a

 

或者直接檢視版本檔案

cat /etc/lsb-release

一般來說除了網域名稱之外,我們也可以透過IP來訪問網站,不過這會造成一個問題,當有人刻意用不同的網域名稱指向你網站的IP時,網站也可以正常訪問,這樣會產生搜尋引擎重複收錄網站,這對SEO會有不良影響。

那麼在apache要如何避免這種問題產生呢?很簡單,只要增加一個Virtualhost即可,作法如下:

  1. 增加一個VirtualHost,在httpd.conf裡新增以下資料
    NameVirtualHost *:80
    <VirtualHost *:80> 
      ServerName xxx.xxx.xxx.xxx
      <Location />
        Order Allow,Deny
        Deny from All
      </Location>
    </VirtualHost>
  2. 重讀設定檔
    service apache2 graceful
     

P.S.本文適用於ubuntu

  1. 測試設定檔文法是否正確
    apachectl configtest
     
  2. 套用新設定檔,但不重啟apache,在ubuntu可以用第二個
    service apache2 graceful
    service apache2 reload
     
  3. 啟動apache
    service apache2 start
     
  4. 重啟apache
    service apache2 restart
     
  5. 停止apache
    service apache2 stop

在先前的文章 利用Views建立標籤雲 中有提到可以利用聚合(aggregation)的方式來計算類別文章數。不過後來找到另外一個方式,可以利用Contextul filter + relationship 來達成。作法如下:

  1. 建立一個Taxonomy view
  2. 設定relationship,選擇 Content with term,接著勾選「Require this relationship」
  3. 新增一個Contextul filter:「分類項目: 名稱」,設定大概如下圖
  4. 基礎路徑要記得設定,選單的連結會無法對應實際的類別頁。

步驟如下:

  1. 啟用RoundCube的Password 插件
    • 編輯RoundCube主設定檔 config/config.inc.php ,增加以下內容:
      $config['plugins'] = array('password');
    • 另存Password插件設定樣板檔 plugins/password/config.inc.php.dist =>config.inc.php
      cp conf.inc.php.dist conf.inc.php
       
  2. 編輯Password插件設定檔 plugins/password/config.inc.php,更新以下內容:
    $config['password_hosts'] = array('localhost');  //視postfixadmin所使用的資料庫位置而定
    $config['password_db_dsn'] ='mysql://dbuser:password@localhost/dbname' //資料庫連線資料
    $config['password_query'] = 'UPDATE mailbox SET password=%c WHERE username=%u'; //
更多