編輯php.ini,並修改以下設定:
定義垃圾收集過程開始的機率;機率以 session.gc_probability / session.gc_divisor方式機算,session.gc_probability是分子,session.gc_divisor 是分母,如 session.gc_probability = 1,session.gc_divisor = 100,大約會有1%的機率
session.gc_probability 1
session.gc_divisor 100
在設定的秒數後,儲存的數據將被視為垃圾,並被垃圾收集過程清理!
session.gc_maxlifetime 1440
設定完後重新啟動php與apache!
2018年11月8日 星期四
2018年11月3日 星期六
2018年11月2日 星期五
roundcube temp 資料夾自動清除
修改php.ini
session.gc_probability = 1
#php session存活時間(秒)
; After this number of seconds, stored data will be seen as 'garbage' and
; cleaned up by the garbage collection process.
; http://php.net/session.gc-maxlifetime
session.gc_maxlifetime = 1440
session.gc_divisor = 100
存檔後重新啟動apache和php
2018年10月25日 星期四
reject the empty envelope-sender, <>
方法1:
main.cf,添加以下設定
main.cf,添加以下設定
smtpd_restriction_classes = submission_sender_checks
submission_sender_checks =
check_sender_access hash:/etc/postfix/reject_null_sender
master.cf,添加以下設定
# existing submission entry
submission ... smtpd
... other options ...
# add sender restrictions
-o smtpd_sender_restrictions=$submission_sender_checks
新增reject_null_sender,並增加以下內容
# reject_null_sender
<> REJECT null sender not allowed
check_sender_access hash:/etc/postfix/reject_null_sender
master.cf,添加以下設定
# existing submission entry
submission ... smtpd
... other options ...
# add sender restrictions
-o smtpd_sender_restrictions=$submission_sender_checks
新增reject_null_sender,並增加以下內容
# reject_null_sender
<> REJECT null sender not allowed
sudo postmap reject_null_sender
sudo service postfix restart
=======================================================
方法2:
main.cf添加以下設定
=======================================================
方法2:
main.cf添加以下設定
smtpd_reject_unlisted_sender = yes
2018年10月21日 星期日
Wordpress 404錯誤
Apache rewrite 必須開啟
sudo a2enmod rewrite
修改sit設定檔
在<VirtualHost *:80>內添加以下設定
<Directory "/var/www/wordpress/">
AllowOverride All
</Directory>
存檔後重新啟動apache
若還是無法解決,可以進入管理後台,在設定下的固定網址頁面,直接點選“儲存變更”,讓wordpress自動產生一個.htaccess檔案,應該可以順利解決404問題!若不能自動產生或修改.htacdess,需手動修改添加以下內容至.haccess
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
sudo a2enmod rewrite
修改sit設定檔
在<VirtualHost *:80>內添加以下設定
<Directory "/var/www/wordpress/">
AllowOverride All
</Directory>
存檔後重新啟動apache
若還是無法解決,可以進入管理後台,在設定下的固定網址頁面,直接點選“儲存變更”,讓wordpress自動產生一個.htaccess檔案,應該可以順利解決404問題!若不能自動產生或修改.htacdess,需手動修改添加以下內容至.haccess
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
2018年9月19日 星期三
ngx_headers_more
ngx_headers_more 可添加、設定和清除輸入和輸出的標頭訊息
在Ubuntu下需額外安裝
sudo apt install nginx-extras
在nginx.conf內設定,例如:
more_set_headers "Server: Apache";
設定完重新啟動nginx即可
sudo service nginx restart
在Ubuntu下需額外安裝
sudo apt install nginx-extras
在nginx.conf內設定,例如:
more_set_headers "Server: Apache";
設定完重新啟動nginx即可
sudo service nginx restart
2018年9月6日 星期四
2018年8月23日 星期四
Swift 4.1 錯誤訊息:[discovery] errors encountered while discovering extensions: Error Domain=PlugInKit Code=13 "query cancelled" UserInfo={NSLocalizedDescription=query cancelled}
1- From Xcode menu open: Product > Scheme > Edit Scheme
2- On your Environment Variables set OS_ACTIVITY_MODE in the value set disable
2- On your Environment Variables set OS_ACTIVITY_MODE in the value set disable
2018年8月20日 星期一
Ubuntu Bind subDomain設定
編輯 /etc/bind/named.conf.local
重新啟動bind!
//master host
zone "demo.domain" {
type master;
file "/路徑/你的檔名";
// 若有slave主機,在這裡新增slave的IP
allow-transfer { 192.168.100.10; };
};
//slave host
zone "demo.domain" {
type slave;
file "/路徑/你的檔名";
// master主機的IP
masters { 192.168.100.254; };
};
//subdomain
zone "sub.demo.domain" {
type master;
file "/路徑/你的檔名";
};
編輯主網域的設定檔
$TTL 86400
@ IN SOA dns1.demo.domain. root.demo.domain. (
2018082001 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
86400 ) ; Negative Cache TTL
;
@ IN NS dns1.demo.domain.
@ IN A 192.168.118.232
dns1 IN A 192.168.118.232
www IN A 2.3.4.5
mail IN A 5.6.7.8
sub IN NS dns1.sub.demo.domain. //子網域NS記錄
ns.sub IN A 192.168.118.232 //子網域A記錄
編輯子網域的設定檔,添加需要的記錄
$TTL 86400
@ IN SOA dns1.sub.demo.domain. root.sub.demo.domain. (
2018082001 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
86400 ) ; Negative Cache TTL
;
@ IN NS dns1.sub.demo.domain.
@ IN A 11.12.13.14
dns1 IN A 192.168.118.232
www IN A 11.12.13.14
o365 IN A 100.101.102.103
重新啟動bind!
2018年8月15日 星期三
iphone 解析度
iphone XS:2436 x 1125 像素,458 ppi 解析度
iphone XS Max:2688 x 1242 像素,458 ppi 解析度
iphone XR:1792 x 828 像素,326 ppi 解析度
iphone X :2436 x 1125 像素,458 ppi 解析度
iphone 8 Plus:1920 x 1080 像素,401 ppi 解析度
iphone 8:1334 x 750 像素,326 ppi 解析度
iphone 7 Plus:1920 x 1080 像素,401 ppi 解析度
iphone 7:1334 x 750 像素,326 ppi 解析度
iphone 6s Plus:1920 x 1080 像素,401 ppi 解析度
iphone 6s:1334 x 750 像素,326 ppi 解析度
iphone SE:1136 x 640 像素,326 ppi 解析度
iphone 6 Plus:1920 x 1080 像素,401 ppi 解析度
iphone 6:1334 x 750 像素,326 ppi 解析度
iphone XS Max:2688 x 1242 像素,458 ppi 解析度
iphone XR:1792 x 828 像素,326 ppi 解析度
iphone X :2436 x 1125 像素,458 ppi 解析度
iphone 8 Plus:1920 x 1080 像素,401 ppi 解析度
iphone 8:1334 x 750 像素,326 ppi 解析度
iphone 7 Plus:1920 x 1080 像素,401 ppi 解析度
iphone 7:1334 x 750 像素,326 ppi 解析度
iphone 6s Plus:1920 x 1080 像素,401 ppi 解析度
iphone 6s:1334 x 750 像素,326 ppi 解析度
iphone SE:1136 x 640 像素,326 ppi 解析度
iphone 6 Plus:1920 x 1080 像素,401 ppi 解析度
iphone 6:1334 x 750 像素,326 ppi 解析度
2018年7月31日 星期二
Ubuntu 18.04 修改Mysql資料存放預設位置
在mysql下輸入以下指令,可以查看mysql存放位置
show variables like '%dir%';
show variables like '%dir%';
其中,basedir是mysql安裝的位置,而datadir 是資料庫檔案存放的位置,也就是這次要修改的設定
假設新的mysql 資料存放位置在/Mysql下
1.停止mysql運作
sudo server mysql stop
2.複製原來資料庫檔案到新的位置(cp -a 維持複製檔案的權限屬性)
sudo cp -a /var/lib/mysql /Mysql
3.修改 /etc/mysql/mysql.conf.d/mysqld.cnf 設定檔內datadir的值,將
datadir = /var/lib/mysql
改成
datadir = /Mysql/mysql
4.修改/etc/apparmor.d/usr.sbin.mysqld,找到以下兩行
/var/lib/mysql/ r,
/var/lib/mysql/** rwk,
替換成
/Mysql/mysql/ r,
/Mysql/mysql/** rwk,
5. 修改 /etc/apparmor.d/abstractions/mysql,找到以下這行
/var/lib/mysql{,d}/mysql{,d}.sock rw,
替換成
/Mysql/mysql{,d}/mysql{,d}.sock rw,
6.
sudo /etc/init.d/apparmor restart
7.
sudo server mysql start
另外,mysql是以mysql這組帳號執行,須確保mysql對
/Mysql/mysql
有寫入的權限!且對
/Mysql
有讀取與執行(r,x)的權限!
2018年6月9日 星期六
2018年6月1日 星期五
Ubuntu 18.04 變更主機名稱
1. edit /etc/cloud/cloud.cfg and set the parameter "preserve_hostname" from "false" to "true"
2. edit /etc/hostname
3. reboot
2. edit /etc/hostname
3. reboot
2018年5月22日 星期二
2018年5月17日 星期四
vim 註解顏色
Vim預設的註解顏色是深藍色,看得實在很痛苦......可以將其設定改成:
bg=dark
這樣會把注解的顏色改成淺藍色,感覺上好很多!
可以將其設定成預設值,只修改單一使用者,可修改家目錄下的.vimrc﹝若不存在可自行新增﹞;若是改為全系統預設,可以修改/etc/vimrc﹝Ubuntu放在/etc/vim/vimrc,若不存在可自行新增﹞,在設定檔內加上:
set bg=dark
存檔後重新登入再登入即可生效!
bg=dark
這樣會把注解的顏色改成淺藍色,感覺上好很多!
可以將其設定成預設值,只修改單一使用者,可修改家目錄下的.vimrc﹝若不存在可自行新增﹞;若是改為全系統預設,可以修改/etc/vimrc﹝Ubuntu放在/etc/vim/vimrc,若不存在可自行新增﹞,在設定檔內加上:
set bg=dark
存檔後重新登入再登入即可生效!
訂閱:
文章 (Atom)