2016年9月8日 星期四

有關intel 600p 安裝win7步驟

==事前準備===
請先確定你的主機板(Biso有Nvme驅動)可以找到intel 600p那顆硬碟,如圖所示和普通硬碟一顆(HDD或非PCIe的SSD)





1.KB2990941、KB3087873修正檔
2.Win10PE x64 Uefi 開機U碟 請下載win10pe x64版 或 x86x64二合一版 皆可,
3.使用Rufus作UEFI開機碟 照裡面教學,記得選擇下載win10pe的ISO檔





==製作步驟==
1.以你常用的方式重灌HDD WIN7系統(新電腦重灌),若是後來加裝600p,就不用重灌了

2.以HDD(或原先系統)開機 將2個修正檔安裝上去 然後重開機以HDD(或原先系統)進入 看是否600p已可抓到

3.以U碟開機 將HDD(或原先系統)C槽做備份檔 然後直接還原到600p或直接ghost partition to partition直接對拷到600p記得先弄好MBR/4K,再看一下600p的active是否有開啟 PS:沒試過直接對拷 但應該是可行:D

4.選擇intel 600p開機,就OK了


















備註:目前測試aomei onekey recovery 和 ghost一鍵還原皆無法還原,只能用win10pe內的ghost還原

2015年3月15日 星期日

定期清除apache內的log

參考文章:http://fecbob.pixnet.net/blog/post/38253745

1.常發現log檔太大造成開啟不易可設定檔案大小
修改ee /usr/local/etc/apache22/httpd.conf

ErrorLog "|/usr/local/sbin/rotatelogs /var/log/error自設檔名.log 86400"

#讓HTTPd-eccess.log每個log檔案大小限制為5M

CustomLog "|/usr/local/sbin/rotatelogs /var/log/access自設檔名.log 5M" common

2.再來設置sh檔清除30天前的log檔
ee /usr/local/etc/apache22/lograte.sh

#!/bin/sh
find /var/log/httpd-access.log.* -type f -mtime +30 -exec rm '{}' \;
find /var/log/httpd-error.log.* -type f -mtime +30 -exec rm '{}' \;
apachectl graceful

存檔後
chmod a+x lograte.sh

3.固定時間執行lograte.sh
ee /etc/crontab
* 3 * * 0 root /usr/local/etc/apache22/lograte.sh

2014年12月9日 星期二

win2003 FTP 只限上傳/下載設定

內容->安全性->進階,勾選底下項目

==只限上傳==
列出資料夾/讀取資料
建立檔案/寫入資料
建立資料夾/附加資料
寫入屬性
寫入擴充屬性
讀取權限

==只限下載==
周遊資料夾/執行檔案
讀取屬性
讀取擴充屬性
讀取權限

2014年6月10日 星期二

變更Mysql資料庫DB及使用者後無法使用情況

若我們在變更資料庫使用者權限時,郤會發生無法連結情況
請在SQL下執行
flush privileges
強制更新權限,應該就可以使用了

2014年4月23日 星期三

error_log 常出現 File does not exist 的解決方式

因為日誌常出現File does not exist:的問題,造成apache2老是停止工作,上網查了之後有方式解決,目前觀察中是否有效
安裝mod_limitipconn2(apache2.x)若是apache1.x版的請安裝mod_limitipconn 設定應該都一樣吧

安裝方式:

#cd /usr/ports/www/mod_limitipconn2#make install clean

在 /usr/local/etc/apache22/httpd.conf 加入底下設定

<ifmodule mod_limitipconn.c>
   <location>
          MaxConnPerIP 3  
          NoIPLimit image/*
    </location>
</ifmodule>

重新啟動Apache
#apachectl restart

2012年6月27日 星期三

阻擋spider 124.115



編輯apache22內httpd.conf


AllowOverride None
Order allow,deny
Allow from all
#底下添加,封鎖由124.115所有IP
Deny from 124.115



2012年6月13日 星期三

crontab 的設定,例行性執行

參照:http://carrl.blogspot.tw/2005/03/freebsd-crontab.html
為避免該日誌關閉,故複製其內容,sorry

Linux / FreeBSD OS下 , 要設定某時間自動執行某支程式 , 就要用到 cron , 這也可以稱為"例行性工作"
要設定 cron , 可以使用 crontab 這個指令
crontab [-u user] [-l | -e | -r]
參數說明 :
-u user :只有 root 能下達的參數,視察或編譯其他使用者的 crontab 內容
-l :列出 crontab 的內容
-e :編輯 crontab 的內容
-r :刪除 crontab 的內容

使用 crontab -e 進入編輯模式 , 可以看到類似以下的文字 :
0 12 * * 0 root ntpdate watch.stdtime.gov.tw
代表的意義是 => 每個星期天的 12:00 用 root 身分執行 ntpdate ... 的指令
詳細說明 :
分時日月星期身分要執行的指令
012**0rootntpdate watch.stdtime.gov.tw

星期為 0 代表星期天
* 號代表任何時候

使用 crontab -e 是設定個人自己的 "例行性工作"
如果要變更系統用的 "例行性工作" , 那就得要去修改 /etc/crontab 這個檔案了 , 其格式跟上面的說明一樣

==/etc/crontab目前設定值為==

59 * * * 0 root /usr/sbin/ntpdate -s time.stdtim


0 4 * * * root reboot

10 4 * * * root reboot

0 3 * * 3 root clrlog


Mysql Too many connections 解决方法

修改ee /etc/my.cnf

==my.cnf內容新增==
max_connections = 1000

修改完後重啟
/usr/local/etc/rc.d/mysql-server restart

2012年2月12日 星期日

網站主機換IP後設置

1.編輯etc/rc.conf
ifconfig_網路介面卡="inet xxx.xxx.xxx.xxx(欲更改的IP) netmask 255.255.255.0"
defaultrouter="xxx.xxx.xxx.xxx(欲更改的default gateway)"
2.修改etc/hosts
127.0.0.1 localhost
xxx.xxx.xxx.xxx localhost(區網內IP)
xxx.xxx.xxx.xxx localhost(對外WAN IP)
其餘照舊即可

2010年10月27日 星期三

網管指令

nslookup指令介紹

有些時候, user 可能會想要手動查詢 DNS 上一些資料, 或者是要看看 DNS 是否有問題,
此時我們最常用的工具就是 nslookup 了,
基本上 nslookup 會根據 /etc/resolv.conf 的內容去找到所要使用的 local DNS server.

2010年4月13日 星期二

php時間戳與日期互轉(轉)

PHP時間大的來分有兩種,一是時間戳類型(1228348800),二是正常日期格式(2008-12-4)

所以存到數據庫也有兩種形式了(真正不止,我的應用就兩種),時間戳類型我是保存為字符串的,這個是比較方便的.

正常日期類型是保存為DATE型的.

這兩個要注意一下,我平時用兩種,所以,前幾天建的表,把時間類型存為DATE的,我還一直用時間戳保存,一直資料寫不進表,調試了好久的才知錯誤之處,是類型不符合,不給寫入庫.

像上面的時間戳是比較方便,但,顯示的時候,不至於把這個1228348800串給客戶看吧,GOD NOWS!

所 以就用到了這兩個的轉換,先說一下如何取得當前的時間戳,$date1=time();這樣就取得當前的時間戳了,要轉回2008-12-4這種格式呢, 用到date()這個函數了,在PHP中date()函數比較常用,如取得當前日期,可以用$date2=date('Y-m-d');,關於裡面參數的 意思,如不懂就查一下php的手冊了.

好,言歸正傳,把1228348800轉成2008-12-4格式代碼如下:

$date3=date('Y-m-d H:i:s',"1228348800");

這樣就OK了,如還想得到小時,分鐘秒,只要把'Y-m-d'改一下就可以了,不過要注意一下,PHP時間還像有8個小時的誤差.加上就OK了.

時間戳轉正常日期有了,反之呢,把正常日期格式轉為時間戳呢,請看如下代碼:

$year=((int)substr("2008-12-04",0,4));//取得年份

$month=((int)substr("2008-12-04",5,2));//取得月份

$day=((int)substr("2008-12-04",8,2));//取得幾號

echo mktime(0,0,0,$month,$day,$year);

這樣就能把正常日期轉成時間戳了,這裡如果有時分秒也是同理,

注意:php5.1以上時間戳會與實際時間相差8小時,解決辦法如下
1、最簡單的方法就是不要用php5.1以上的版本--顯然這是不可取的方法!!!

2、修改php.ini。打開php.ini查找date.timezone 去掉前面的分號= 後面加Asia/Shanghai,重啟apache服務器即可--缺點就是如果程序
放到別人的服務器上,不能修改php.ini,那就奈何不得了。

3、在程序中添加時間的初始化的語句的 即:「date_default_timezone_set("Asia/Shanghai"); 」這個可以由程序員任意設置,我的推
薦。
時區標識符,大陸內地可用的值是:PRC,Asia/Chongqing ,Asia/Shanghai ,Asia/Urumqi (依次為中國,重慶,上海,烏魯木齊) ,Etc/GMT-8,Asia/Harbin
港台地區可用:Asia/Macao ,Asia/Hong_Kong ,Asia/Taipei (依次為澳門,香港,台北)
還有新加坡:Asia/Singapore

2010年4月2日 星期五

檔案轉向,防盜連

原文出處:
台灣PHP聯盟[ Taiwan PHP User Group ]

$dir = "files";
if($_GET['getfile']&&!preg_match('/\//i', $_GET['getfile'])){
$the_file = $dir . '/' . $_GET['getfile'];
if(file_exists($the_file)){
header('Content-disposition: attachment; filename='.$_GET['getfile']);
$fh = fopen($the_file, 'r');
while(!feof($fh)){
echo fgets($fh, 4096);
}
fclose($fh);
} else echo '您所選擇的檔案不存在!';
} else {
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
if($file!='.'&&$file!='..'&&!is_dir($dir.'/'.$file))
echo ''.$file.'
';
}
closedir($dh);
}
}
}

2010年3月31日 星期三

[PHP] 驗證碼

原文出處:[PHP] 驗證碼2

/*定義header,聲明圖片文件,最好是png,無版權之擾; */
/*生成新的四位整數驗證碼 */
header('Content-type:image/png');
header('Content-Disposition:filename=image_code.png');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');


/* 字形檔的路徑 */
$TTF="/var/lib/defoma/fontconfig.d/D/DejaVu-Serif-Bold.ttf";

/* 開啟 SESSION */
if (!isset($_SESSION)) { session_start(); }

/* 設定亂數種子 */
mt_srand((double)microtime()*1000000);


/* 類型選擇 */
switch ($_GET['t']) {
case 'post':
//定義用來顯是在圖片上的文字
$codeBase='ABCDEFGHJKLMNPRSTUVWXYZ23456789';

$codeLength=5; //定義循環隨機抽取的位數
$codeName='checkPostCode'; // 認證碼名稱
$textSize=18; // 字體大小(點)
$proportion=0.2; //字寬加乘比例
break;

case 'min_post':
//定義用來顯是在圖片上的文字
$codeBase='ABCDEFGHJKLMNPRSTUVWXYZ23456789';

$codeLength=5; // 定義循環隨機抽取的位數
$codeName='checkMinPostCode'; // 認證碼名稱
$textSize=18; // 字體大小(點)
$proportion=0.2; // 字寬加乘比例
break;

case 'shoutbox':
//定義用來顯是在圖片上的文字
$codeBase='1234567890';

$codeLength=3; // 定義循環隨機抽取的位數
$codeName='checkShoutCode'; // 認證碼名稱
$imageX=60; $imageY=24; // 圖片的長寬
$textSize=18; // 字體大小(點)
$proportion=0.2; // 字寬加乘比例
break;

case 'comm':
default:
//定義用來顯是在圖片上的文字
$codeBase='1234567890';

$codeLength=3; // 定義循環隨機抽取的位數
$codeName='checkMsgCode'; // 認證碼名稱
$textSize=18; // 字體大小(點)
$proportion=0.2; // 字寬加乘比例
break;
}

// 圖片的高度
$imageY=intval($textSize*(1+$proportion));
// 圖片的寬度
$imageX=$imageY*$codeLength;


/*建立圖片物件 */
$im = @imagecreatetruecolor($imageX, $imageY) or die('Image Error');

/* 設定底色 */
imagefill($im,0,0,
imagecolorallocate($im, 255,255,255)
);


/* 建立筆刷 */
$s=intval($textSize/8);
$brush = imagecreate($s,$s);
imagesetbrush($im,$brush);

/*底色干擾線條 */
$l=$codeLength*7;
for($i=0;$i<$l;$i++){
imagefill($brush,0,0,imagecolorallocate(
$brush, rand(127,255),rand(127,255),rand(127,255)
));
imageline(
$im,
rand(0,$imageX),
rand(0,$imageY),
rand($imageY,$imageX),
rand(0,$imageY),
IMG_COLOR_BRUSHED
);
}


/*得到字串的長度;減1是因為截取字符是從0開始起算;*/
$l = strlen($codeBase)-1;
$widgetSize=$imageX/$codeLength;
$codeStr = '';

/*循環隨機抽取前面定義的文字*/
for($i=0;$i<$codeLength;$i++){
/*每次隨機抽取一位數字;從第一個字到該字串最大長度, */
$num=rand(0,$l);
$codeStr.= $codeBase[$num];

/*利用true type字型來產生圖片 */
$Color = imagecolorallocate( // 文字顏色
$im,rand(0,60),rand(0,60),rand(0,60)
);
imagettftext(
$im,
$textSize,
rand(-25,25),
$widgetSize*($i+$proportion),
$textSize,
$Color,
$TTF,
$codeBase[$num]
);

/*
imagettftext (int im, int size, int angle,
int x, int y, int col,
string fontfile, string text)

im 圖片物件
size 文字大小
angle 0度將會由左到右讀取文字,而更高的值表示逆時鐘旋轉
x y 文字起始座標
col 顏色物件
fontfile 字形路徑,為主機實體目錄的絕對路徑,可自行設定想要的字型
text 寫入的文字字串
*/
}


/* 建立筆刷 */
$s=intval($textSize/9);
$brush = imagecreate($s,$s);
imagesetbrush($im,$brush);

/* 文字干擾像素 */
$l=$codeLength*13;
for($i=0;$i<$l;$i++){
imagefill($brush,0,0,imagecolorallocate(
$brush,rand(40,100),rand(40,100),rand(40,100)
));
imagesetpixel(
$im,
rand(0,$imageX),
rand(0,$imageY),
IMG_COLOR_BRUSHED
);
}


/*用session來做驗證也不錯;註冊session,名稱為checkMsgCode, */
/*其它頁面只要包含了該圖片 */
/*即可以通過$_SESSION['checkMsgCode']來調用 */
session_register($codeName);
$_SESSION[$codeName] = $codeStr;

imagepng($im);
imagedestroy($im);

2009年10月29日 星期四

樹狀menu

  



2009年10月14日 星期三

FreeBSD SSH配置

文章出處:FreeBSD SSH配置詳解

首先vi編輯/etc/inetd.conf,去掉ssh前的#,保存退出
編輯/etc/rc.conf
最後加入:sshd_enable="yes"即可
激活sshd服務:
#/etc/rc.d/sshd start
用下面命令檢查服務是否啟動,在22端口應該有監聽。
#netstat -an //檢視有無 *.22 LISTEN
最後
vi /etc/ssh/sshd_config,

下面是我的配置文件:(/etc/ssh/sshd_config)
####################################################

# $OpenBSD: sshd_config,v 1.72 2005/07/25 11:59:40 markus Exp $
# $FreeBSD: src/crypto/openssh/sshd_config,v 1.42.2.1 2005/09/11 16:50:35 des Exp $

# This is the sshd server system-wide configuration file. See
# sshd_config(5) for more information.

# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin

# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented. Uncommented options change a
# default value.

# Note that some of FreeBSD's defaults differ from OpenBSD's, and
# FreeBSD has a few additional options.

#VersionAddendum FreeBSD-20050903

#Port 22
#Protocol 2
#AddressFamily any
#ListenAddress 10.1.10.196
#ListenAddress ::

# HostKey for protocol version 1
#HostKey /etc/ssh/ssh_host_key
# HostKeys for protocol version 2
#HostKey /etc/ssh/ssh_host_dsa_key

# Lifetime and size of ephemeral version 1 server key
#KeyRegenerationInterval 1h
#ServerKeyBits 768

# Logging
# obsoletes QuietMode and FascistLogging
#SyslogFacility AUTH
#LogLevel INFO

# Authentication:

#LoginGraceTime 2m
#PermitRootLogin no
#StrictModes yes
#MaxAuthTries 6

#RSAAuthentication yes
#PubkeyAuthentication yes
#AuthorizedKey .ssh/authorized_keys
# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#RhostsRSAAuthentication no
# similar for protocol version 2
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# RhostsRSAAuthentication and HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes

# Change to yes to enable built-in password authentication.
PasswordAuthentication yes
#PermitEmptyPasswords no

# Change to no to disable PAM authentication
#ChallengeResponseAuthentication yes

# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

# Set this to 'no' to disable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication mechanism.
# Depending on your PAM configuration, this may bypass the setting of
# PasswordAuthentication, PermitEmptyPasswords, and
# "PermitRootLogin without-password". If you just want the PAM account and
# session checks to run without PAM authentication, then enable this but set
# ChallengeResponseAuthentication=no
#UsePAM yes

#AllowTcpForwarding yes
#GatewayPorts no
#X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
#UsePrivilegeSeparation yes
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS no
#PidFile /var/run/sshd.pid
#MaxStartups 10

# no default banner path
#Banner /some/path

# override default of no subsystems
Subsystem sftp /usr/libexec/sftp-server

IgnoreRhosts yes
IgnoreUserKnownHosts yes
PrintMotd yes
StrictModes no
RSAAuthentication yes
PermitRootLogin yes #允許root登錄
PermitEmptyPasswords no #不允許空密碼登錄
PasswordAuthentication yes # 設置是否使用口令驗證。

##############################################

記得修改完配置文件後,重新啟動sshd服務器(/etc/rc.d/sshd restart)即可。

2009年9月15日 星期二

清空apache的log檔案

清除方式:
cp /dev/null /var/log/httpd-access.log
cp /dev/null /var/log/httpd-error.log

使用別名清除(bash):
編輯/etc/profile
ee /etc/profile
aslias clrlog="cp /dev/null /var/log/httpd-access.log;cp /dev/null /var/log/httpd-error.log"

2009年8月26日 星期三

2009年7月9日 星期四

MySQL資料庫中一堆mysql-bin.00000X的東東

MySQL資料庫中,一堆mysql-bin.000001、mysql-bin.000002…的東東,有些都爆大的,網路搜尋找到官網有人提出類似問題:
http://forums.mysql.com/read.php?26,127650,127650
基本上可刪除它,它只是一般的log檔案。
==MS系統使用方式,從1開始==
1. 開始→執行→cmd

2. cd C:\AppServ\MySQL\data(進入存放這些log檔案的資料夾中)
==Freebsd系統使用方式,從3開始==
3. mysql -u root -p

4. 輸入MySQL密碼

5. mysql> reset master;(最後面的分號別忘了加上)

6. my.ini中可以註解掉
#log-bin=mysql-bin
#binlog_format=mixed

以後就不會再生出來這麼多的mysql-bin.00000X,目前預設都沒開啟,想要開啟的可以自己加入。

7. 也可直接刪除mysql-bin.00000X的東東。

突發狀況記錄

關於出現sh/sell錯誤指令,而無法正常開機
解決如下
fsck -y
mount -a
reboot