helloworld

目前分類:系統管理 (418)

瀏覽方式: 標題列表 簡短摘要

varnish 是一套效能不錯的reverse proxy server 
但美中不足的,他不支援https
所以如果要讓網站同時支援https , 就必須要另外加裝其他套件來做 ssl termination 的角色
以下範例是利用nginx 來當 ssl termination


cd /etc/nginx/ssl
cat STAR_pass_tw.crt COMODORSADomainValidationSecureServerCA.crt COMODORSAAddTrustCA.crt AddTrustExternalCARoot.crt > pass.tw.bundle.crt


cd /etc/nginx/conf.d
vi pass.tw.conf
  server {
    listen 443 ssl;
    server_name pass.tw
    ssl on;
    ssl_certificate /etc/nginx/ssl/pass.tw.bundle.crt;
    ssl_certificate_key /etc/nginx/ssl/pass.tw.key;
    ssl_protocols       TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers   HIGH:!aNULL:!MD5;

    # side note: only use TLS since SSLv2 and SSLv3 have had recent vulnerabilities
    #ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    location / {
      proxy_pass http://127.0.0.1:80;
    }
  }


/etc/init.d/nginx restart

undefined
Nginx技術手札:網頁伺服器應用全攻略

作者: 苗澤  
出版社:上奇資訊  
出版日期:2017/02/23
語言:繁體中文
定價:580元

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

執行以下指令立即生效
export http_proxy="http://your-proxy-server:3128"

如果希望未來登入後都可以套用proxy
可以新增進 .bash_profile
 

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

$ echo 123 | mail -s test 'test@myip.pass.tw'
-bash: mail: command not found

$ which mail
/usr/bin/which: no mail in (/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbinin:/sbin)

解決方式
# yum -y install mailx

 

Dependencies Resolved

================================================================================
 Package         Arch             Version                  Repository      Size
================================================================================
Installing:
 mailx           x86_64           12.4-8.el6_6             base           235 k

Transaction Summary
================================================================================
Install       1 Package(s)
 

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

新版的CentOS 網路代號不像之前的 eth0 , eth1 ....
一開始可能會不習慣,但時勢所趨,還是早點習慣的好

早期的centos / redhat 版本可以透過setup 指令來修改網路的設定
但centos 已經沒有這個指令了
除了一樣可以透過手動編輯  /etc/sysconfig/network-scripts/ifcfg-xxx 
也可以改用 nmtui ( NetworkManager TUI )設定,透過互動的設定 ip、是否啟用該網路介面、及設定主機名稱



undefined

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

如果要讓一個virtual 設定同時服務 http 和 https  
預設的 apache 2.2 無法直接達到這個需求

但是可以利用 include 的功能來勉強達到這個需求
大部分共用的設定寫在 pass.tw-http.inc
有關ssl 的設定另外再獨立出一個 .inc 檔案
例如
<VirtualHost *:80>
   ServerAlias test.pass.tw
   include /usr/local/etc/apache22/extra/pass.tw-http.inc
</VirtualHost>

<VirtualHost *:443>
   SSLEngine on
   ServerAlias test.pass.tw
   include /usr/local/etc/apache22/extra/pass.tw-http.inc
   include /usr/local/etc/apache22/extra/pass.tw-https.inc
</VirtualHost>

但還是要注意
1. ServerAlias 要寫在<VirtualHost> 裡面,不可以寫在include file中
1. SSLEngine on 要寫在<VirtualHost> 裡面,不可以寫在include file中

undefined
WordPress站長練功秘笈:網站客製化、佈景主題與外掛開發的16堂課

出版社:博碩  
出版日期:2017/04/28
語言:繁體中文
定價:580元

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

#!/bin/sh

#自動產生亂數並除以10取餘數,所以就可以得出 0~9 的亂數
echo $(($RANDOM % 10))

#也可以加一個整數,取某個區間的亂數
echo $((5+$RANDOM % 10))

undefined
Linux Shell程式設計實力養成:225個實務關鍵技巧徹底詳解(附DVD)(第二版)

作者: 酆士昌  
出版社:博碩  
出版日期:2016/07/01
語言:繁體中文
定價:490元

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

AH00526: Syntax error on line 539 of /usr/local/etc/apache24/httpd.conf:
Invalid command 'ProxyPass', perhaps misspelled or defined by a module not included in the server configuration

解決方式
vi /usr/local/etc/apache24/httpd.conf

以下兩行取消註解
LoadModule proxy_module libexec/apache24/mod_proxy.so
LoadModule proxy_http_module libexec/apache24/mod_proxy_http.so

重啟apache
apachectl restart

undefined
Learning HTTP/2: A Practical Guide for Beginners

作者: Ludin, Stephen/ Garza, Javier
原文出版社:Oreilly & Associates Inc
出版日期:2017/06/02
語言:英文
 

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

如果經常在修改git內容
每次的pull,  push 都輸入帳號密碼是非常煩人的
可以利用以下指令來記憶帳號密碼
git config --global credential.helper 'cache --timeout 86400' 
以上例子為 86400 秒,也就是一天

如果要永久儲存
可以輸入
git config --global credential.helper 'cache --timeout 86400' 

但會把帳號密碼明碼寫在 ~/.git-credentials
就看個人習慣


undefined

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

redis 跟 memcached 一樣,是一套存儲在記憶體中的key-value nosql 資料庫
預設的port 是 tcp : 6379
常用在網站的cache, 目的在不用過於頻繁的直接讀寫資料庫

在 FreeBSD 上面安裝很簡單
# cd /usr/ports/databases/redis
# make install clean

===>  CONFIGURATION NOTE:

      To setup "redis" you need to edit the configuration file:
      /usr/local/etc/redis.conf

      To run redis from startup, add redis_enable="YES"
      in your /etc/rc.conf.

===> SECURITY REPORT:
      This port has installed the following files which may act as network
      servers and may therefore pose a remote security risk to the system.
/usr/local/bin/redis-sentinel
/usr/local/bin/redis-cli
/usr/local/bin/redis-server
/usr/local/bin/redis-check-rdb
/usr/local/bin/redis-benchmark

      This port has installed the following startup scripts which may cause
      these network services to be started at boot time.
/usr/local/etc/rc.d/sentinel
/usr/local/etc/rc.d/redis

      If there are vulnerabilities in these programs there may be a security
      risk to the system. FreeBSD makes no guarantee about the security of
      ports included in the Ports Collection. Please type 'make deinstall'
      to deinstall the port if this is a concern.

      For more information, and contact details about the security
      status of this software, see the following webpage:
http://redis.io/

啟動 redis 
# /usr/local/etc/rc.d/redis onestart

開機時自動啟用
# vi /etc/rc.conf
redis_enable="YES"

檢查是否正常啟動
# ps uax | grep redis
redis    18947   0.2  0.1   24244   4040  -  Ss    3:51PM    0:00.01 redis-server: /usr/local/bin/redis-server 127.0.0.1:6379 (redis
root     18949   0.0  0.0   18832   2052  1  R+    3:51PM    0:00.00 grep redis

# telnet 0 6379
Trying 0.0.0.0...
Connected to 0.
Escape character is '^]'.
info
$2120
# Server
redis_version:3.2.7
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:66485aa7a7c124f8
redis_mode:standalone
os:FreeBSD 10.3-RELEASE amd64
arch_bits:64
multiplexing_api:kqueue
gcc_version:4.2.1
process_id:18947
run_id:018b4976dccd8701fac6727da769ebc8df8b2c68
tcp_port:6379
uptime_in_seconds:17
uptime_in_days:0
hz:10
lru_clock:15227282
executable:/usr/local/bin/redis-server
config_file:/usr/local/etc/redis.conf

# Clients
connected_clients:1
client_longest_output_list:0
client_biggest_input_buf:0
blocked_clients:0

# Memory
used_memory:1084112
used_memory_human:1.03M
used_memory_rss:1050368
used_memory_rss_human:1.00M
used_memory_peak:1084112
used_memory_peak_human:1.03M
total_system_memory:34389189192
total_system_memory_human:32.03G
used_memory_lua:37888
used_memory_lua_human:37.00K
maxmemory:0
maxmemory_human:0B
maxmemory_policy:noeviction
mem_fragmentation_ratio:0.97
mem_allocator:libc

# Persistence
loading:0
rdb_changes_since_last_save:0
rdb_bgsave_in_progress:0
rdb_last_save_time:1508399489
rdb_last_bgsave_status:ok
rdb_last_bgsave_time_sec:-1
rdb_current_bgsave_time_sec:-1
aof_enabled:0
aof_rewrite_in_progress:0
aof_rewrite_scheduled:0
aof_last_rewrite_time_sec:-1
aof_current_rewrite_time_sec:-1
aof_last_bgrewrite_status:ok
aof_last_write_status:ok

# Stats
total_connections_received:1
total_commands_processed:0
instantaneous_ops_per_sec:0
total_net_input_bytes:6
total_net_output_bytes:0
instantaneous_input_kbps:0.00
instantaneous_output_kbps:0.00
rejected_connections:0
sync_full:0
sync_partial_ok:0
sync_partial_err:0
expired_keys:0
evicted_keys:0
keyspace_hits:0
keyspace_misses:0
pubsub_channels:0
pubsub_patterns:0
latest_fork_usec:0
migrate_cached_sockets:0

# Replication
role:master
connected_slaves:0
master_repl_offset:0
repl_backlog_active:0
repl_backlog_size:1048576
repl_backlog_first_byte_offset:0
repl_backlog_histlen:0

# CPU
used_cpu_sys:0.01
used_cpu_user:0.00
used_cpu_sys_children:0.00
used_cpu_user_children:0.00

# Cluster
cluster_enabled:0

# Keyspace

undefined
奠定大數據的基石:NoSQL資料庫技術(第2版)

作者: 皮雄軍  
出版社:佳魁資訊  
出版日期:2016/07/29
語言:繁體中文
定價:560元

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

假設一個跨國企業網站
讓來自台灣的訪客可以造訪台灣機房
來自日本的訪客可以造訪日本機房
其餘的訪客造訪另一個機房

cd /etc
wget http://geoip.site/download/MaxMind/GeoIP.acl

vi named.conf

include "/etc/GeoIP.acl";
view "TW" {
  match-clients { TW; };
  zone "TW-myip.pass.tw" {
    type master;
    file "JP.myip.pass.tw.zone";
  };
};

view "JP" {
  match-clients { JP; };
  zone "JP-myip.pass.tw" {
    type master;
    file "JP.myip.pass.tw.zone";
  };
};

view "ANY" {
  match-clients { any; };
  zone "ANY-myip.pass.tw" {
    type master;
    file "JP.myip.pass.tw.zone";
  };
};

最後重啟named 即可
 

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

可以先測試一下自己有沒有把網站資訊不小心洩漏出來
http://your-web-site/?=PHPB8B5F2A0-3C92-11d3-A3A9-4C7B08C10000

如何關閉
vi php.ini
expose_php = On
修改成
expose_php = Off

重啟apache 或是 php-fpm 即可

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

email 的傳遞有點像現實生活種的郵差先生在寄信
分為信封寄件者和信紙寄件者
envelope-from 顧名思義,就是寫在信封或是包裹上面的寄件者
所以是給郵差和MTA 看的

信紙寄件者,通常就是我們常看到信件的最下面寫著 XXX 敬上 .. 之類的稱呼
是給收件者看的,通常outlook 及其他MUA顯示的是這個欄位

php mail() 
bool mail ( string $to , string $subject , string $message [, string $additional_headers [, string $additional_parameters ]] )
通常我們都會把From: 寫在第四個變數
但是這只是修改信紙寄件者
郵差先生看到的寄件者還是系統自動幫你帶的,不一定會跟From 會一樣
往往這樣可能會造成一些退信的狀況

建議From: 和 envelope from 都可以改成一致
避免不必要的困擾

example:
<?php
mail('ethan@a.com','Hello World!','Good morning!','From: service@b.com','-f service@b.com');
?>

undefined
PHP、MySQL與JavaScript學習手冊(第五版)
Learning PHP, MySQL & JavaScript, 5th Edition

作者: Robin Nixon  
譯者: 賴屹民
出版社:歐萊禮 

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

下載  Rufus
https://rufus.akeo.ie/?locale=zh_TW

因為 Rufus 不支援 FreeBSD iso檔
所以我們選img檔案
以FreeBSD 11.1 為例
檔名為 FreeBSD-11.1-RELEASE-amd64-memstick.img

選擇剛剛下載的img檔,並下拉選擇DD映像


最後執行即可

undefined
【Ainmax】64GB 高速隨身碟(USB3.0)

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

如果拿到一顆硬碟開心的要把它重新分割
但是始終保留一個 EFI 系統磁碟分割區 怎麼砍也砍不掉
這時候可以
用系統管理員身分執行cmd
輸入diskpart
 

C:\Windows\system32>diskpart

Microsoft DiskPart 版本 6.1.7601
Copyright (C) 1999-2008 Microsoft Corporation.
在電腦: PC-helloworld

 

 

列出接在電腦的硬碟

 

DISKPART> list disk

  磁碟 ###  狀態           大小     可用     Dyn  Gpt
  --------  -------------  -------  -------  ---  ---
  磁碟 0    連線              489 GB    23 GB
  磁碟 1    連線              476 GB   476 GB        *


選擇要清理的硬碟
 

DISKPART> select disk 1

磁碟 1 是所選擇的磁碟。

DISKPART> list disk

  磁碟 ###  狀態           大小     可用     Dyn  Gpt
  --------  -------------  -------  -------  ---  ---
  磁碟 0    連線              489 GB    23 GB
* 磁碟 1    連線              476 GB   476 GB        *


 確定真的不留戀的話,輸入clean
 

DISKPART> clean

DiskPart 成功地清理了磁碟。

DISKPART>

回頭看windows 的磁碟管理,可以看到磁碟機已經乾乾淨淨啦



undefined
【WD】100EFAX 紅標 10TB 3.5吋NAS硬碟(NASware3.0)
http://www.momoshop.com.tw/goods/GoodsDetail.jsp?osm=league&i_code=4827757&cid=apuad&oid=1&memid=6000013660

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

安裝完drupal 8 之後,系統會需要你做一些簡單的設定
如果在需求檢查步驟出現以下的警告訊息
Your server is capable of using clean URLs, but it is not enabled. Using clean URLs gives an improved user experience and is recommended


表示你的 drupal 目錄無法使用rewrite 功能
如果是apache請確認以下設定
LoadModule rewrite_module libexec/apache24/mod_rewrite.so

Alias /drupal "/usr/local/www/drupal8"
<Directory "/usr/local/www/drupal8">
    Options  FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

修改完後重新啟動apache
apachectl reload


undefined
Drupal的使用 中文版 第二版
作者: (美)拜倫
出版社:中國電力出版社
出版日期:2014/03/01

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

預設的狀況下,varnish 下面的backend , 諸如 apache 或是 nginx ... 等
接到 http 的 請求時,client ip 都是varnish 的ip
如此一下,程式無法針對來源做出判斷,geoip 也無法知道來源是屬於哪個國家
解決這個問題步驟如下

編輯 varnish/default.vcl
sub vcl_recv {
###
    if (req.restarts == 0) {
            if (req.http.x-forwarded-for) {
                    set req.http.X-Forwarded-For = req.http.X-Forwarded-For + ", " + client.ip;
            } else {
                    set req.http.X-Forwarded-For = client.ip;
            }
    }
###
}

修改backend log format 設定,以apache為例

#LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

即可在access_log 中看到實際使用者來源ip
 

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

nslookup這個指令對於網路除錯來說,應該是很多人都很習慣的工具
如果發現安裝好的Linux系統少了這個指令

[root@example ~]# nslookup myip.pass.tw
-bash: nslookup: command not found

[root@example ~]# which nslookup
/usr/bin/which: no nslookup in (/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)

直接安裝看看咧? 找不到這個套件名稱
[root@example ~]# yum -y install nslookup
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
 * base: mirrors.linode.com
 * epel: mirror.sfo12.us.leaseweb.net
 * extras: mirrors.linode.com
 * updates: mirrors.linode.com
No package nslookup available.
Error: Nothing to do

試試 yum provides 看看nslookup 是包含在哪個套件中
[root@example ~]# yum provides nslookup
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.linode.com
 * epel: mirror.sfo12.us.leaseweb.net
 * extras: mirrors.linode.com
 * updates: mirrors.linode.com
Warning: 3.0.x versions of yum would erroneously match against filenames.
 You can use "*/nslookup" and/or "*bin/nslookup" to get that behaviour
No Matches found

依提示再搜尋一下,可以發現包含在bind-utils 套件中
[root@example ~]# yum provides */nslookup
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.linode.com
 * epel: mirror.sfo12.us.leaseweb.net
 * extras: mirrors.linode.com
 * updates: mirrors.linode.com
base/filelists_db                                                                                                                                                                                                     | 6.4 MB     00:00
epel/filelists_db                                                                                                                                                                                                     | 7.7 MB     00:01
extras/filelists_db                                                                                                                                                                                                   |  25 kB     00:00
updates/filelists_db                                                                                                                                                                                                  | 1.5 MB     00:00
zsh-4.3.11-4.el6.centos.2.x86_64 : A powerful interactive shell
Repo        : base
Matched from:
Filename    : /usr/share/zsh/4.3.11/functions/nslookup

32:bind-utils-9.8.2-0.62.rc1.el6.x86_64 : Utilities for querying DNS name servers
Repo        : base
Matched from:
Filename    : /usr/bin/nslookup

32:bind-utils-9.8.2-0.62.rc1.el6_9.2.x86_64 : Utilities for querying DNS name servers
Repo        : updates
Matched from:
Filename    : /usr/bin/nslookup

32:bind-utils-9.8.2-0.62.rc1.el6_9.4.x86_64 : Utilities for querying DNS name servers
Repo        : updates
Matched from:
Filename    : /usr/bin/nslookup

32:bind-utils-9.8.2-0.62.rc1.el6_9.1.x86_64 : Utilities for querying DNS name servers
Repo        : updates
Matched from:
Filename    : /usr/bin/nslookup

[root@example ~]# yum provides *bin/nslookup
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.linode.com
 * epel: mirrors.kernel.org
 * extras: mirrors.linode.com
 * updates: mirrors.linode.com
32:bind-utils-9.8.2-0.62.rc1.el6.x86_64 : Utilities for querying DNS name servers
Repo        : base
Matched from:
Filename    : /usr/bin/nslookup

32:bind-utils-9.8.2-0.62.rc1.el6_9.2.x86_64 : Utilities for querying DNS name servers
Repo        : updates
Matched from:
Filename    : /usr/bin/nslookup

32:bind-utils-9.8.2-0.62.rc1.el6_9.4.x86_64 : Utilities for querying DNS name servers
Repo        : updates
Matched from:
Filename    : /usr/bin/nslookup

32:bind-utils-9.8.2-0.62.rc1.el6_9.1.x86_64 : Utilities for querying DNS name servers
Repo        : updates
Matched from:
Filename    : /usr/bin/nslookup

安裝 bind-utils
[root@example ~]# yum -y install bind-utils
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
 * base: mirrors.linode.com
 * epel: mirrors.kernel.org
 * extras: mirrors.linode.com
 * updates: mirrors.linode.com
Resolving Dependencies
--> Running transaction check
---> Package bind-utils.x86_64 32:9.8.2-0.62.rc1.el6_9.4 will be installed
--> Processing Dependency: bind-libs = 32:9.8.2-0.62.rc1.el6_9.4 for package: 32:bind-utils-9.8.2-0.62.rc1.el6_9.4.x86_64
--> Processing Dependency: liblwres.so.80()(64bit) for package: 32:bind-utils-9.8.2-0.62.rc1.el6_9.4.x86_64
--> Processing Dependency: libisccfg.so.82()(64bit) for package: 32:bind-utils-9.8.2-0.62.rc1.el6_9.4.x86_64
--> Processing Dependency: libisccc.so.80()(64bit) for package: 32:bind-utils-9.8.2-0.62.rc1.el6_9.4.x86_64
--> Processing Dependency: libisc.so.83()(64bit) for package: 32:bind-utils-9.8.2-0.62.rc1.el6_9.4.x86_64
--> Processing Dependency: libdns.so.81()(64bit) for package: 32:bind-utils-9.8.2-0.62.rc1.el6_9.4.x86_64
--> Processing Dependency: libbind9.so.80()(64bit) for package: 32:bind-utils-9.8.2-0.62.rc1.el6_9.4.x86_64
--> Running transaction check
---> Package bind-libs.x86_64 32:9.8.2-0.62.rc1.el6_9.4 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================================================================================================
 Package                                                Arch                                               Version                                                                 Repository                                           Size
=============================================================================================================================================================================================================================================
Installing:
 bind-utils                                             x86_64                                             32:9.8.2-0.62.rc1.el6_9.4                                               updates                                             189 k
Installing for dependencies:
 bind-libs                                              x86_64                                             32:9.8.2-0.62.rc1.el6_9.4                                               updates                                             892 k

Transaction Summary
=============================================================================================================================================================================================================================================
Install       2 Package(s)

Total download size: 1.1 M
Installed size: 2.7 M
Downloading Packages:
(1/2): bind-libs-9.8.2-0.62.rc1.el6_9.4.x86_64.rpm                                                                                                                                                                    | 892 kB     00:00
(2/2): bind-utils-9.8.2-0.62.rc1.el6_9.4.x86_64.rpm                                                                                                                                                                   | 189 kB     00:00
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                                                         44 MB/s | 1.1 MB     00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : 32:bind-libs-9.8.2-0.62.rc1.el6_9.4.x86_64                                                                                                                                                                                1/2
  Installing : 32:bind-utils-9.8.2-0.62.rc1.el6_9.4.x86_64                                                                                                                                                                               2/2
  Verifying  : 32:bind-libs-9.8.2-0.62.rc1.el6_9.4.x86_64                                                                                                                                                                                1/2
  Verifying  : 32:bind-utils-9.8.2-0.62.rc1.el6_9.4.x86_64                                                                                                                                                                               2/2

Installed:
  bind-utils.x86_64 32:9.8.2-0.62.rc1.el6_9.4

Dependency Installed:
  bind-libs.x86_64 32:9.8.2-0.62.rc1.el6_9.4

Complete!

undefined
DNS and BIND管理,第五版

作者: 蔣大偉  
出版社:歐萊禮

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

Varnish cache,或稱Varnish,是一套高效能的反向網站快取伺服器(reverse proxy server)。
其他的類似產品還有Nginx 或是 Squid 可供選擇

官方網站
https://www.varnish-cache.org/

安裝步驟
# vi /etc/yum.repos.d/varnish.repo

[varnish]
name=Varnish for Enterprise Linux 6
baseurl=https://repo.varnish-cache.org/redhat/varnish-4.0/el6/
enabled=1
gpgkey=https://repo.varnish-cache.org/GPG-key.txt
gpgcheck=1

存檔離開

# yum -y install varnish
Loaded plugins: fastestmirror, security
Setting up Install Process
Loading mirror speeds from cached hostfile
 * base: centos.cs.nctu.edu.tw
 * epel: mirror01.idc.hinet.net
 * extras: centos.cs.nctu.edu.tw
 * updates: centos.cs.nctu.edu.tw
Resolving Dependencies
--> Running transaction check
---> Package varnish.x86_64 0:4.0.4-1.el6 will be installed
--> Processing Dependency: jemalloc for package: varnish-4.0.4-1.el6.x86_64
--> Processing Dependency: gcc for package: varnish-4.0.4-1.el6.x86_64
--> Processing Dependency: libjemalloc.so.1()(64bit) for package: varnish-4.0.4-1.el6.x86_64
--> Running transaction check
---> Package gcc.x86_64 0:4.4.7-18.el6 will be installed
--> Processing Dependency: cpp = 4.4.7-18.el6 for package: gcc-4.4.7-18.el6.x86_64
--> Processing Dependency: cloog-ppl >= 0.15 for package: gcc-4.4.7-18.el6.x86_64
---> Package jemalloc.x86_64 0:3.6.0-1.el6 will be installed
--> Running transaction check
---> Package cloog-ppl.x86_64 0:0.15.7-1.2.el6 will be installed
--> Processing Dependency: libppl_c.so.2()(64bit) for package: cloog-ppl-0.15.7-1.2.el6.x86_64
--> Processing Dependency: libppl.so.7()(64bit) for package: cloog-ppl-0.15.7-1.2.el6.x86_64
---> Package cpp.x86_64 0:4.4.7-18.el6 will be installed
--> Processing Dependency: libmpfr.so.1()(64bit) for package: cpp-4.4.7-18.el6.x86_64
--> Running transaction check
---> Package mpfr.x86_64 0:2.4.1-6.el6 will be installed
---> Package ppl.x86_64 0:0.10.2-11.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package           Arch           Version                 Repository       Size
================================================================================
Installing:
 varnish           x86_64         4.0.4-1.el6             varnish         1.5 M
Installing for dependencies:
 cloog-ppl         x86_64         0.15.7-1.2.el6          base             93 k
 cpp               x86_64         4.4.7-18.el6            base            3.7 M
 gcc               x86_64         4.4.7-18.el6            base             10 M
 jemalloc          x86_64         3.6.0-1.el6             epel            100 k
 mpfr              x86_64         2.4.1-6.el6             base            157 k
 ppl               x86_64         0.10.2-11.el6           base            1.3 M

Transaction Summary
================================================================================
Install       7 Package(s)

Total download size: 17 M
Installed size: 39 M
Downloading Packages:
(1/7): cloog-ppl-0.15.7-1.2.el6.x86_64.rpm               |  93 kB     00:00
(2/7): cpp-4.4.7-18.el6.x86_64.rpm                       | 3.7 MB     00:00
(3/7): gcc-4.4.7-18.el6.x86_64.rpm                       |  10 MB     00:00
(4/7): jemalloc-3.6.0-1.el6.x86_64.rpm                   | 100 kB     00:00
(5/7): mpfr-2.4.1-6.el6.x86_64.rpm                       | 157 kB     00:00
(6/7): ppl-0.10.2-11.el6.x86_64.rpm                      | 1.3 MB     00:00
(7/7): varnish-4.0.4-1.el6.x86_64.rpm                    | 1.5 MB     00:04
--------------------------------------------------------------------------------
Total                                           2.1 MB/s |  17 MB     00:08
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : ppl-0.10.2-11.el6.x86_64                                     1/7
  Installing : cloog-ppl-0.15.7-1.2.el6.x86_64                              2/7
  Installing : mpfr-2.4.1-6.el6.x86_64                                      3/7
  Installing : cpp-4.4.7-18.el6.x86_64                                      4/7
  Installing : gcc-4.4.7-18.el6.x86_64                                      5/7
  Installing : jemalloc-3.6.0-1.el6.x86_64                                  6/7
  Installing : varnish-4.0.4-1.el6.x86_64                                   7/7
  Verifying  : cpp-4.4.7-18.el6.x86_64                                      1/7
  Verifying  : varnish-4.0.4-1.el6.x86_64                                   2/7
  Verifying  : jemalloc-3.6.0-1.el6.x86_64                                  3/7
  Verifying  : mpfr-2.4.1-6.el6.x86_64                                      4/7
  Verifying  : gcc-4.4.7-18.el6.x86_64                                      5/7
  Verifying  : ppl-0.10.2-11.el6.x86_64                                     6/7
  Verifying  : cloog-ppl-0.15.7-1.2.el6.x86_64                              7/7

Installed:
  varnish.x86_64 0:4.0.4-1.el6

Dependency Installed:
  cloog-ppl.x86_64 0:0.15.7-1.2.el6        cpp.x86_64 0:4.4.7-18.el6
  gcc.x86_64 0:4.4.7-18.el6                jemalloc.x86_64 0:3.6.0-1.el6
  mpfr.x86_64 0:2.4.1-6.el6                ppl.x86_64 0:0.10.2-11.el6

Complete!
 



安裝好的varnish 預設路徑
/etc/varnish/default.vcl

undefined
關鍵技術:CDN內容傳遞網路

Content Delivery Network
作者: 梁潔, 陳戈, 莊一嶸  
出版社:佳魁資訊  
出版日期:2017/03/28
語言:繁體中文
定價:480元

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

更新ports tree
# portsnap fetch extract update

安裝 mongodb
# cd /usr/ports/databases/mongodb34

勾選相依套件選項
# make config-recursive

開始漫長的編譯,可以去泡個茶先
# make install clean

預設設定檔路徑
/usr/local/etc/mongodb.conf

設定開機自動執行
# vi /etc/rc.conf
mongod_enable="YES"

重開機或手動啟動mongodb
/usr/local/etc/rc.d/mongod start
OR
service mongod start

查看服務狀況,預設監聽 tcp 27017 port , 僅綁定 127.0.0.1 本機可以連線
可依需求修改設定檔
# netstat -na
Active Internet connections (including servers)
Proto Recv-Q Send-Q Local Address          Foreign Address        (state)
tcp4       0      0 127.0.0.1.27017        *.*                    LISTEN

執行程序
# ps uax | grep mongo
mongodb  3431   0.1  1.7 292860 69860  -  S     3:17PM    0:02.20 /usr/local/bin/mongod --logpath /var/db/mongodb/mongod.log --logappend --config /usr/local/etc/mongodb.conf --dbpath /var/db/mongodb --fork

undefined
MongoDB 大數據管理系統實戰指南

作者: 郭遠威  
出版社:上奇資訊  
出版日期:2016/09/29
語言:繁體中文
定價:350元

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

假設如果要在freebsd透過ports 安裝apache24
除了是漫長的compile 過程外
再來就是不時會被其他相依套件中斷,提醒你要勾選相依套件的選項
想要好好去廁所大個便都不行

如果要解決這個問題,好好的去蹲廁所
可以參考以下步驟
# cd /usr/ports/www/apache24
# make config-recursive
===> Setting user-specified options for apache24-2.4.26 and dependencies

接下來一一勾選相依套件的選項後
# make insall clean
即可

文章標籤

helloworld 發表在 痞客邦 留言(0) 人氣()

Close

您尚未登入,將以訪客身份留言。亦可以上方服務帳號登入留言

請輸入暱稱 ( 最多顯示 6 個中文字元 )

請輸入標題 ( 最多顯示 9 個中文字元 )

請輸入內容 ( 最多 140 個中文字元 )

reload

請輸入左方認證碼:

看不懂,換張圖

請輸入驗證碼