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
Learning HTTP/2: A Practical Guide for Beginners
作者: Ludin, Stephen/ Garza, Javier
原文出版社:Oreilly & Associates Inc
出版日期:2017/06/02
語言:英文
目前分類:系統管理 (432)
- Nov 30 Thu 2017 09:21
[apache] Invalid command 'ProxyPass' 錯誤訊息
- Nov 06 Mon 2017 10:45
記憶git帳號密碼
- Oct 19 Thu 2017 15:52
freebsd 安裝 redis
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
奠定大數據的基石:NoSQL資料庫技術(第2版)
作者: 皮雄軍
出版社:佳魁資訊
出版日期:2016/07/29
語言:繁體中文
定價:560元
- Sep 25 Mon 2017 14:55
GeoIP + Bind + view 針對國家回應不同dns位置
假設一個跨國企業網站
讓來自台灣的訪客可以造訪台灣機房
來自日本的訪客可以造訪日本機房
其餘的訪客造訪另一個機房
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 即可
- Sep 21 Thu 2017 15:54
關閉php 彩蛋
可以先測試一下自己有沒有把網站資訊不小心洩漏出來
http://your-web-site/?=PHPB8B5F2A0-3C92-11d3-A3A9-4C7B08C10000
如何關閉
vi php.ini
expose_php = On
修改成
expose_php = Off
重啟apache 或是 php-fpm 即可
- Sep 15 Fri 2017 14:49
使用php mail() 寄信並指定 envelope-from
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');
?>
PHP、MySQL與JavaScript學習手冊(第五版)
Learning PHP, MySQL & JavaScript, 5th Edition
作者: Robin Nixon
譯者: 賴屹民
出版社:歐萊禮
- Sep 14 Thu 2017 15:35
使用Rufus 製作FreeBSD開機usb 隨身碟
下載 Rufus
https://rufus.akeo.ie/?locale=zh_TW
因為 Rufus 不支援 FreeBSD iso檔
所以我們選img檔案
以FreeBSD 11.1 為例
檔名為 FreeBSD-11.1-RELEASE-amd64-memstick.img
選擇剛剛下載的img檔,並下拉選擇DD映像
最後執行即可
【Ainmax】64GB 高速隨身碟(USB3.0)
- Sep 13 Wed 2017 16:40
移除比小強還強的 EFI 系統磁碟分割區
如果拿到一顆硬碟開心的要把它重新分割
但是始終保留一個 EFI 系統磁碟分割區 怎麼砍也砍不掉
這時候可以
用系統管理員身分執行cmd
輸入diskpart
C:\Windows\system32>diskpart Microsoft DiskPart 版本 6.1.7601 |
列出接在電腦的硬碟
DISKPART> list disk 磁碟 ### 狀態 大小 可用 Dyn Gpt |
選擇要清理的硬碟
DISKPART> select disk 1 磁碟 1 是所選擇的磁碟。 DISKPART> list disk 磁碟 ### 狀態 大小 可用 Dyn Gpt |
確定真的不留戀的話,輸入clean
DISKPART> clean DiskPart 成功地清理了磁碟。 DISKPART> |
回頭看windows 的磁碟管理,可以看到磁碟機已經乾乾淨淨啦
【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
- Aug 11 Fri 2017 10:16
啟用 drupal 8 clean URLs
安裝完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
Drupal的使用 中文版 第二版
作者: (美)拜倫
出版社:中國電力出版社
出版日期:2014/03/01
- Jul 21 Fri 2017 16:27
Varnish 下的 backend 取得實際的client ip
預設的狀況下,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
- Jul 13 Thu 2017 09:56
CentOS 安裝 nslookup
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!
DNS and BIND管理,第五版
作者: 蔣大偉
出版社:歐萊禮
- Jul 11 Tue 2017 09:18
CentOS / RedHat 安裝 varnish 4
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
關鍵技術:CDN內容傳遞網路
Content Delivery Network
作者: 梁潔, 陳戈, 莊一嶸
出版社:佳魁資訊
出版日期:2017/03/28
語言:繁體中文
定價:480元
- Jul 05 Wed 2017 15:24
FreeBSD 10.x 安裝 Mongodb 3.4
更新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
MongoDB 大數據管理系統實戰指南
作者: 郭遠威
出版社:上奇資訊
出版日期:2016/09/29
語言:繁體中文
定價:350元
- Jul 03 Mon 2017 15:34
freebsd透過ports安裝套件前,一次設定相依套件
假設如果要在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
即可
- Jul 03 Mon 2017 15:31
freebsd 出現 You have security/openssl installed but do not have DEFAULT_VERSIONS+=ssl=openssl set in your make.conf
如果你除了內建的openssl 又自行安裝比較新版的openssl
在安裝其他套件時出現以下警告訊息
/!\ WARNING /!\
You have security/openssl installed but do not have
DEFAULT_VERSIONS+=ssl=openssl set in your make.conf
解決方式
echo 'DEFAULT_VERSIONS+=ssl=openssl' >> /etc/make.conf
即可
- Jul 03 Mon 2017 13:41
顯示 memcached 狀態
[root@test] ~# echo stats | nc memcached-server 11211
STAT pid 16817
STAT uptime 181573
STAT time 1499060450
STAT version 1.4.4
STAT pointer_size 64
STAT rusage_user 186.459653
STAT rusage_system 581.109657
STAT curr_connections 12
STAT total_connections 163313
STAT connection_structures 71
STAT cmd_get 8260007
STAT cmd_set 811378
STAT cmd_flush 0
STAT get_hits 7935925
STAT get_misses 324082
STAT delete_misses 0
STAT delete_hits 1
STAT incr_misses 0
STAT incr_hits 0
STAT decr_misses 0
STAT decr_hits 0
STAT cas_misses 0
STAT cas_hits 0
STAT cas_badval 0
STAT auth_cmds 0
STAT auth_errors 0
STAT bytes_read 7135925788
STAT bytes_written 14480451759
STAT limit_maxbytes 2147483648
STAT accepting_conns 1
STAT listen_disabled_num 0
STAT threads 4
STAT conn_yields 0
STAT bytes 283099957
STAT curr_items 211892
STAT total_items 811378
STAT evictions 0
END
^C
- Jul 03 Mon 2017 12:08
紀錄 wget 抓網頁過程
wget -R jpg,gif,css,js -r -l 2 --delete-after http://myip.pass.tw/ | & tee wget.log
-R: 排除某些檔案不抓
-r: 遞迴抓取網頁
-l: 抓到第幾層
--delete-after: 移除暫存網頁
網站擷取:使用Python
Web Scraping with Python
作者: Ryan Mitchell
譯者:Studio Tib.
出版社:歐萊禮
出版日期:2016/10/03
語言:繁體中文
- Jun 28 Wed 2017 10:15
解決nginx+php-fpm : FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream 錯誤訊息
安裝好nginx + php-fpm 後,ngixn error log出現以下錯誤訊息
2017/06/28 10:06:46 [error] 949#100116: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 192.168.77.252, server: ng.test.com, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "example.com:8080"
預設參考範例
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi_params;
}
修改為以下設定
location ~ \.php$ {
#root html;
root "你的網頁路徑";
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
#fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
重新啟動nginx 即可
MIS 一定要懂的82個伺服器建置與管理知識
作者: きはし まさひろ
譯者: 陳禹豪, 黃瑋婷
出版社:旗標
- Jun 27 Tue 2017 14:08
清除varnish 某個cache資料
varnishadm
ban req.http.host == "example.com" && req.url ~ "\.png$"
- Jun 08 Thu 2017 17:28
rsync 只監聽特定IP
假設我們的rsync server 有兩張網卡
一張對外、一張對內
如果rsync 的服務只需要對內,不希望外面的人來打擾
當然可以用防火牆來阻擋
但如果不方便用防火牆的話
也可以透過修改設定檔來達成
如果是獨立執行的
參考一下man 說明
address
You can override the default IP address the daemon will listen
on by specifying this value. This is ignored if the daemon is
being run by inetd, and is superseded by the --address com-
mand-line option.
可以修改 rsyncd.conf
address = 要LISTEN的IP
如果是透過xinetd 啟動的
可以修改 /etc/xinetd.d/rsync
加入 bind = 要LISTEN的IP
或是考慮其他參數
如
only_from 或是 only_from