顯示具有 ubuntu 標籤的文章。 顯示所有文章
顯示具有 ubuntu 標籤的文章。 顯示所有文章

2021年9月12日 星期日

PHP Version 7.0.33-0ubuntu0.16.04.16升級後php.ini要修改

 /etc/php/7.0/apache2/php.ini

 upload_max_filesize = 300M //單一檔案最大容量 單位(MB)
post_max_size = 300M //表單post最大容量 單位(MB)
max_execution_time = 300 //執行時間最久多長 單位(秒)

2021年8月10日 星期二

2021年8月9日 星期一

php網頁打開變原始碼

 設定/etc/apache2/mods-enabled/php7.1.conf

<IfModule mod_userdir.c>
<Directory /home/*/public_html>
php_admin_flag engine On
</Directory>
</IfModule>

php_admin_flag engine On (OFF)原本OFF 改On
重新啟動伺服器

2020年8月24日 星期一

2016年2月10日 星期三

安裝cacti問題集

1.安裝cacti
#apt-get install snmpd cacti cacti-spine

2.沒建立資料庫及帳號
解決 : 請將預設的資料結構(/var/www/html/cacti/cacti.sql)匯入到剛建立的cacti資料庫中。
#mysqladmin -u root -p create cacti
#mysql -u root -p cacti < /var/www/cacti/sql/cacti.sql


2016年2月9日 星期二

ubuntu安裝snmp

檢查是否已安裝SNMP:

#snmpwalk -v 1 127.0.0.1 -c public
#snmpwalk -v 2c -c public 127.0.0.1

出現 No Response from 127.0.0.1 表示未安裝 SNMP。
#apt-get install snmpd

修改 SNMP 設定,讓其他 IP 也可以讀取資訊。

vi /etc/snmp/snmpd.conf
將  agentAddress  udp:127.0.0.1:161 更改---> agentAddress  udp:0.0.0.0:161
重新啟動 SNMP
/etc/init.d/snmpd restart

2015年11月9日 星期一

ubuntu升級後出現錯誤訊息

ubuntu升級後出現錯誤訊息
1.網頁無法開啟(重開網頁)出現以下錯誤訊息
------------------------------------------------------------
 /etc/init.d/apache2 restart
 * Restarting web server apache2                                                                                       [fail]
 * The apache2 configtest failed.
Output of config test was:
apache2: Syntax error on line 208 of /etc/apache2/apache2.conf: Could not open configuration file /etc/apache2/httpd.conf: No such file or directory
------------------------------------------------------------
註解第208行
#Include httpd.conf

2.
下載亮哥防火牆程式
http://163.23.89.100/pub/sfs_tool/ufirewall.N2.sh.txt

sudo mv ufirewall.N2.sh.txt  firewall.sh #變更名稱
sudo chmod 755  firewall.sh #變更為可執行
#查詢網卡名稱
ifconfig
#編修防火牆內容
sudo vim   firewall.sh
...................................

 將程式拷貝到系統執行目錄/bin內
sudo cp   firewall.sh  /bin/

寫到開機自動執行檔內 /etc/rc.local
sudo vim  /etc/rc.local
在exit 0 之前加入 /bin/firewall.sh

#啟動防火牆
sudo /bin/firewall.sh

3.There are 2 zombie processes.
找尋 zombie processes 的方式
# ps aux | grep 'Z'
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root      2589  0.0  0.0      0     0 pts/0    ZN   15:11   0:00 [bandwidthd] <defunct>
root      2590  0.1  0.0      0     0 pts/0    ZN   15:11   0:00 [bandwidthd] <defunct>
root      2591  0.1  0.0      0     0 pts/0    ZN   15:11   0:00 [bandwidthd] <defunct>
root      2593  0.0  0.0  10468   904 pts/0    S+   15:11   0:00 grep --color=auto Z

# ps axo pid=,stat= | awk '$2~/^Z/ { print $1 }'
2589
2651
2652





2015年3月3日 星期二

route table 指令操作

<網路文章>
若有特定IP需要連線到該主機,可再手動於routing table內加入允許的連線IP

A.主機的IP是172.11.22.33,其default route是172.11.22.254
可使用netstat -in查出default route 與使用的IP。

刪除default route前先要替自己留後路,先把自己的IP加入routing table內。

1. 檢視routing table
# netstat -rn
Routing tables
Destination           Gateway            Flags   Refs Interface  Pmtu
127.0.0.1             127.0.0.1          UH        0  lo0        4136
172.11.22.33          172.11.22.33       UH        0  lan0       4136
172.11.22.0           172.11.22.33       U         4  lan0       1500
127.0.0.0             127.0.0.1          U         0  lo0           0
default               172.11.22.254      UG        0  lan0          0

 2. 新增自己的IP到routing table
# /usr/sbin/route add host 203.16.100.107 172.11.22.254 1


3. 刪除default route
# route delete net default 172.11.22.254
(刪除後,使用netstat -rn 就看不到default route的資料)


4. 檢視routing table
# netstat -rn
 Routing tables
 Destination           Gateway            Flags   Refs Interface  Pmtu
 127.0.0.1             127.0.0.1          UH        0  lo0        4136
 172.11.22.33          172.11.22.33       UH        0  lan0       4136
 172.11.22.0           172.11.22.33       U         4  lan0       1500
 127.0.0.0             127.0.0.1          U         0  lo0           0
 203.16.100.107        172.11.22.254      UGH       0  lan0          0


5. 新增IP到routing table
# /usr/sbin/route add host 172.20.4.77 172.11.22.254 1


6. 檢視routing table
# netstat -rn
Routing tables
Destination           Gateway            Flags   Refs Interface  Pmtu
127.0.0.1             127.0.0.1          UH        0  lo0        4136
172.11.22.1           172.11.22.33       UH        0  lan0       4136
172.11.22.0           172.11.22.33       U         4  lan0       1500
127.0.0.0             127.0.0.1          U         0  lo0           0
203.16.100.107        172.11.22.254      UGH       0  lan0          0
172.20.4.77           172.11.22.254      UGH       0  lan0          0

7. 移除IP from routing table
# /usr/sbin/route delete host 172.20.4.77 172.11.22.254


8. 檢視routing table
# netstat -rn
Routing tables
Destination           Gateway            Flags   Refs Interface  Pmtu
127.0.0.1             127.0.0.1          UH        0  lo0        4136
 172.11.22.1           172.11.22.33       UH        0  lan0       4136
 172.11.22.0           172.11.22.33       U         4  lan0       1500
 127.0.0.0             127.0.0.1          U         0  lo0           0
203.16.100.107        172.11.22.254      UGH       0  lan0          0

9. 加網段(172.20.0.0)到routing table
# route add net 172.20.0.0 netmask 255.255.0.0 172.11.22.254 1


10. 恢復default route的方式
# route add net 172.11.22.0 netmask 255.255.255.0 172.11.22.254
OR
To add a default route:
# route add default 172.11.22.254

2014年10月8日 星期三

啟用SSL模組 https

啟用SSL模組 https
0.檢查SSL是否啟動,先輸入netstat –na | less
再用/指令指 443 port 有無Listen
1.啟用SSL
 
2.重啟/etc/init.d/apache2 restart 再檢查 netstat –na | less
 
3.vim /bin/firewall.sh 增加 443 port
 

 
 
 
 

2014年8月22日 星期五

網頁.htaccess設密碼登入

在真實位址/home/nature/XXXX/ 下建立兩個檔
.htpasswd 是用來記錄可以登入這個目錄的使用者帳號、密碼。
.htaccess  是用來設定並指定密碼檔用哪一個檔案

可用root權限
1. 進入家目錄(勿進入public_html之下)
vim  .htaccess
加入
AuthName "名稱"
AuthType Basic
AuthUserFile "/home/nature/XXXX/.htpasswd"
require valid-user


2. vim /etc/apache2/apache2.conf  最後一行加入
<Directory "/home/nature/XXXX/">
   AllowOverride All
</Directory>


3.在/home/nature/XXXX/ 下產生.htpasswd檔
 htpasswd -c .htpasswd 自訂帳號
  (系統會要求輸入兩次密碼)
若要建第二組帳密,則取消 -c 否則會被覆蓋

4.重啟
/etc/init.d/apache2 restart

2014年7月8日 星期二

vi取代檔案sources.list內的字串

1. 備份原本的 sources.list
cp /etc/apt/sources.list /etc/apt/sources.list.old
2.使用 vi 編輯器來開啟 sources.list
    vi /etc/apt/sources.list
    在 vi 環境下,下一次更換字串的命令
    :%s/us.archive.ubuntu.com/tw.archive.ubuntu.com/g

2014年7月2日 星期三

ubuntu不正常關的處理方法

Ubuntu不正常關機所產生的錯誤!!

1.利用開機光碟Live版啟動stu123

2.勿掛載任何硬碟(以免發生錯誤)

#blkid 查看掛載

3.#e2fsck -f /dev/sda1

4.#e2fsck -f /dev/sda5

5.#e2fsck -f /dev/sda6

即可

2014年5月27日 星期二

ubuntu系統查詢指令

1.查詢Ubuntu Linux版本 #cat /etc/issue

2.顯示目前硬碟的使用狀況與剩餘空間 #df -h

3.查詢目前所再資料夾的檔案與子資料夾清單 #ls -l

4.查詢USB連接設備 #lsusb

5.顯示目前所在路徑 #pwd

6.顯示如Windows XP工作管理員的資訊 #top

7.顯示Linux核心版本 #uname -a