錯誤整體記錄

錯誤整體記錄

rsync備份服務(wù)類
1.not a regular file
2.remote command not found
3.Connection Refuse
4.sending incremental file list
5.password file must not be other-accessible

NFS服務(wù)類

1.Permission denied
2.Read-only file system

nginx服務(wù)類

1.404 Not Found
2.403 Forbidden
3,3.Cannot assign requested address
4.304 Not Modified
5.conflicting server name
6.hosts沒有添加解析
7.not terminated by ";"
8.重啟或啟動nginx提示錯誤
9.401 Authorization Required
10.File not found.
11 .Connection refused

mysql相關(guān)故障

1.進入mysql報錯
2.數(shù)據(jù)庫不允許遠(yuǎn)程連接

錯誤詳細(xì)
rsync

1.not a regular file
[root@backup ~]# scp /etc  172.16.1.31:/tmp/
root@172.16.1.31's password: 
Permission denied, please try again.
root@172.16.1.31's password: 
/etc: not a regular file##不是·一個·普通文件
scp默認(rèn)只能復(fù)制普通文件 與cp類似
加上-r 即可

2.remote command not found

172.16.1.31:/tmp
root@172.16.1.31's password: 
bash: rsync: command not found
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: remote command not found (code 127) at io.c(226) [sender=3.1.2]
遠(yuǎn)程端命令找不到
遠(yuǎn)程服務(wù)器中沒有這個命令
檢查遠(yuǎn)程服務(wù)器是否安裝了rsync 沒有yum安裝即可

3.Connection refused

連接拒絕
檢查是否能ping通對應(yīng)服務(wù)器或者rsync服務(wù)端修改完配置文件后是否重啟服務(wù)
[root@backup ~]# rsync -avz /etc 176.16.1.31:/tmp
ssh: connect to host 176.16.1.31 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
4.Permission denied
[root@nfs01 ~]# rsync -avz /etc/hostname rsync_backup@172.16.1.41::data --password-file /etc/rsync.password
sending incremental file list
rsync: ERROR: cannot stat destination "." (in data): Permission denied (13)
rsync error: errors selecting input/output files, dirs (code 3) at main.c(635) [Receiver=3.1.2]
錯誤并沒有直接告訴我們是什么驻谆,我們需要看下執(zhí)行日志

查看日志

2019/05/20 20:56:55 [16288] params.c:Parameter() - Ignoring badly formed line in config file: ignore errors
2019/05/20 20:56:55 [16288] connect from nfs01 (172.16.1.31)
2019/05/20 20:56:55 [16288] rsync to data/ from rsync_backup@nfs01 (172.16.1.31)
2019/05/20 20:56:55 [16288] receiving file list
2019/05/20 20:56:55 [16288] rsync: ERROR: cannot stat destination "." (in data): Permission denied (13)
2019/05/20 20:56:55 [16288] rsync error: errors selecting input/output files, dirs (code 3) at main.c(635) [Receiver=3.1.2]
錯誤日志表示目錄所有者為rsync
解決:第一個錯誤:修改文件所有者為rsync就可以了
chmod root:root /etc/rsync.password
第二個錯誤:修改目錄所有者為rsync
chown rsync:rsync /data
5.password file must not be other-accessible
密碼文件不能被他人訪問
[root@nfs01 ~]# rsync -avz /etc/hostname rsync_backup@172.16.1.41::data --password-file /etc/rsync.password
ERROR: password file must not be other-accessible
rsync error: syntax or usage error (code 1) at authenticate.c(196) [sender=3.1.2]
很明顯提示直接告訴我們了悠抹,現(xiàn)在密碼文件是對外人開放的·。把權(quán)限設(shè)置為600即可

解決

修改權(quán)限為600
chmod 600 /etc/rsync.password

NFS服務(wù)類

1.password mismatch
auth failed on module backup from (172.16.1.7) for rsync_backup: password mismatch
nfs
wrong fs type
錯誤的文件系統(tǒng)類型 nfs文件系統(tǒng)無法識別
沒有安裝nfs-utils

mount -t nfs 172.16.1.31:/data /mnt/
mount: wrong fs type, bad option, bad superblock on 172.16.1.31:/data,
       missing codepage or helper program, or other error
       (for several filesystems (e.g. nfs, cifs) you might
       need a /sbin/mount.<type> helper program)
       In some cases useful info is found in syslog - try
       dmesg | tail  or so
2.Permission denied
沒有權(quán)限,拒絕訪問
[root@web01 ~]# touch /data/w/oldboy2.txt
touch: cannot touch ‘/data/w/oldboy2.txt’: Permission denied
嘗試在共享目錄中創(chuàng)建文件,卻提示權(quán)限拒絕。

解決:

檢查下服務(wù)端共享目錄的所有者是否是默認(rèn)虛擬用戶或者指定的虛擬用戶。
[root@nfs01 ~]# ll -d /app/w
drwxr-xr-x 2 root root 43 May 23 08:08 /app/w
把共享目錄所有者修改為用戶映射對應(yīng)的虛擬用戶即可
[root@nfs01 ~]# chown www:www /app/w
3. Read-only file system
只讀文件系統(tǒng)
[root@web01 ~]# touch /data/r/oldboy.txt
touch: cannot touch ‘/data/r/oldboy.txt’: Read-only file system
嘗試在共享目錄中創(chuàng)建文件提示只讀文件系統(tǒng)

解決

檢查nfs配置文件中是否設(shè)置了只讀權(quán)限

[root@nfs01 ~]# cat /etc/exports
#share /app/r
/app/r 172.16.1.0/24(ro,sync,all_squash,anonuid=888,anongid=888)
ro表示權(quán)限為只讀。rw 表示可讀规伐,可寫

4.-rw-r--r-- 1 888 888 0 May 23 08:09 oldboy1.txt
[root@web01 ~]# ll /data/w
total 0
-rw-r--r-- 1 888 888 0 May 23 08:09 oldboy1.txt
-rw-r--r-- 1 888 888 0 May 22 22:33 oldboy.txt
nfs配置文件中設(shè)置all_squash參數(shù)并指定 NFS 的用戶虛擬用戶后。在客戶端創(chuàng)建文件所有者卻顯示為uid和gid.
吧

解決

在客戶端創(chuàng)建一個同樣的用戶即可

[root@web01 ~]# groupadd -g 888 www
[root@web01 ~]# useradd -u 888 -g www -s /sbin/nologin -M www
[root@web01 ~]# id www
uid=888(www) gid=888(www) groups=888(www)
[root@web01 ~]# ll /data/w
total 0
-rw-r--r-- 1 www www 0 May 23 08:09 oldboy1.txt
-rw-r--r-- 1 www www 0 May 22 22:33 oldboy.txt
nginx服務(wù)類
1.403 Forbidden
首頁文件不存在 默認(rèn)找首頁文件 403
或沒有權(quán)限訪問

解決

檢查站點目錄下是否有名為index.html首頁文件弟胀】Γ或者權(quán)限是否為陌生人可見

[root@web01 /usr/share/nginx/html/www]# ll
total 0
[root@web01 /usr/share/nginx/html/www]# curl www.oldboy.com 
<html>
<head><title>403 Forbidden</title></head>
<body>
<center><h1>403 Forbidden</h1></center>
<hr><center>nginx/1.16.0</center>
</body>
</html>
[root@web01 /usr/share/nginx/html/www]# ll
total 4
-rw-r----- 1 root root 15 Jun  5 08:54 index.html
[root@web01 /usr/share/nginx/html/www]# curl www.oldboy.com
<html>
<head><title>403 Forbidden</title></head>
<body>
<center><h1>403 Forbidden</h1></center>
<hr><center>nginx/1.16.0</center>
</body>
</html>
404 Not Found
請求的資源資源不存在

解決

站點目錄下沒有你想要的文件資源

[root@web01 /etc/nginx/conf.d]# curl www.oldboy.com/oldboy.txt
<html>
<head><title>404 Not Found</title></head>
<body>
<center><h1>404 Not Found</h1></center>
<hr><center>nginx/1.16.0</center>
</body>
</html>
3.Cannot assign requested address
無法分配指定的ip地址,本地沒有10.0.0.9ip

解決

配置nginx基于ip的虛擬主機后喊式,檢查語法提示無法分配ip。臨時添加個ip即可


[root@web01 /etc/nginx]# nginx -t 
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: [emerg] bind() to 10.0.0.9:80 failed (99: Cannot assign requested address)
nginx: configuration file /etc/nginx/nginx.conf test failed
ip addr add  10.0.0.9/24 dev eth0  label eth0:1
[root@web01 /usr/share/nginx/html/www]# ip a s eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:0c:29:0f:39:5c brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.7/24 brd 10.0.0.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet 10.0.0.9/24 scope global secondary eth0:2
       valid_lft forever preferred_lft forever
    inet6 fe80::20c:29ff:fe0f:395c/64 scope link 
       valid_lft forever preferred_lft forever
4.304 Not Modified 用戶讀取瀏覽器緩存
5.conflicting server name
域名沖突:有兩個或幾個虛擬主機的域名相同了

解決

修改完域名后提示域名沖突萧朝,

[root@web01 /etc/nginx/conf.d]# nginx -t
nginx: [warn] conflicting server name "www.oldboy.com" on 0.0.0.0:80, ignored
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
grep過濾下是否有相同的域名

[root@web01 /etc/nginx/conf.d]# grep -R www.oldboy.com ../conf.d
../conf.d/01.www.conf:    server_name  www.oldboy.com;
../conf.d/default.conf:    server_name  www.oldboy.com;
6.hosts沒有添加解析
沒有配置hosts解析岔留,用curl命令訪問nginx網(wǎng)站時提示

nginx: [emerg] directive "server_name" is not terminated by ";" in /etc/nginx/nginx.conf:43
nginx: configuration file /etc/nginx/nginx.conf test failed
7.not terminated by ";"
沒有以分號結(jié)尾


[root@wed01 ~]# nginx -t
nginx: [emerg] directive "server_name" is not terminated by ";" in /etc/nginx/nginx.conf:43
nginx: configuration file /etc/nginx/nginx.conf test failed
8.重啟或啟動nginx提示錯誤
[root@web-204 html]# systemctl start nginx
Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.

解決

先使用systemctl stop nginx 關(guān)閉服務(wù)
再啟動 systemctl start nginx 就可以了

9.401 Authorization Required
server模塊中對網(wǎng)站添加的密碼權(quán)限,需要輸入密碼才能查看網(wǎng)站

   auth_basic "Auth access Blog Input your password";
   auth_basic_user_file /etc/nginx/htpasswd;
9. Connection refused
連接被解決

解決

檢查nginx主配置文件的include /etc/nginx/conf.d/*.conf; 這一行检柬,是否是正確的献联。
我出現(xiàn)過的錯誤是少了個f 排查大半天。

11.File not found.
文件找不到

排查思路:

部署LNMP環(huán)境的時候何址,創(chuàng)建一個html結(jié)尾的靜態(tài)資源里逆,一個以php結(jié)尾的動態(tài)資源。訪問靜態(tài)資源可以找到用爪,訪問動態(tài)資源卻提示找不到原押。

[root@web02 /usr/share/nginx/html/www]# curl 10.0.0.8/oldboy.txt
www.oldboy.com
[root@web02 /usr/share/nginx/html/www]# curl 10.0.0.8/oldboy.php
File not found.
檢查nginx網(wǎng)站配置文件

server   {
    listen      80;
    server_name   blog.oldboy.com;
    access_log  /var/log/nginx/access_www.log  main;
    location / {
    root   /usr/share/nginx/html/www;
    index  index.php index.html index.htm;
    try_files $uri $uri/ /index.php?$args;
    }
    location ~* \.(php|php5)$ {
       fastcgi_pass   127.0.0.1:9000;
       fastcgi_index  index.php;
       fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
       include        fastcgi_params;
   }
}

錯誤出現(xiàn)在第二個location里沒有指定站點目錄

解決辦法有兩個第一個就是在第一個location之前指定一個站點目錄。
第二個就是在第二個location里指定一個站點目錄偎血。

mysql相關(guān)
進入mysql報錯
[root@web01 ~]# mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
解決

mysql沒有啟動,啟動mariadb即可解決

[root@web01 ~]# systemctl start mariadb
2.mysql數(shù)據(jù)庫不允許遠(yuǎn)程登錄
[root@nfs01 ~]# mysql -uwordpress -p -h 172.16.1.31
Enter password: 
ERROR 1045 (28000): Access denied for user 'wordpress'@'nfs01' (using password: YES)

解決

第一種原因是用戶對數(shù)據(jù)庫沒有遠(yuǎn)程權(quán)限.授權(quán)用戶遠(yuǎn)程連接權(quán)限即可

grant all      on wordpress.*       to 'wordpress'@'172.16.1.%'  identified by '123456';
第二種原因有空白用戶诸衔,把空白用戶刪掉就可以解決

MariaDB [(none)]> select user,host from mysql.user;
+-----------+------------+
| user      | host       |
+-----------+------------+
| root      | 127.0.0.1  |
| wordpress | 172.16.1.% |
| root      | ::1        |
|           | localhost  |
| root      | localhost  |
| wordpress | localhost  |
|           | nfs01      |
| root      | nfs01      |
+-----------+------------+
MariaDB [(none)]> drop user ''@'nfs01' ;
Query OK, 0 rows affected (0.01 sec)

MariaDB [(none)]> drop user ''@'localhost' ;
Query OK, 0 rows affected (0.00 sec)
用戶權(quán)限發(fā)生改變的后沒有刷新用戶權(quán)限。刷新用戶權(quán)限或者重新啟動mariadb即可解決

MariaDB [(none)]> flush privileges;
或者
systemctl restart mariadb
第四種原因 密碼錯誤颇玷。檢查操作記錄笨农。授權(quán)新的密碼

操作記錄會被放在當(dāng)前用戶下一個隱藏文件里

[root@nfs01 ~]# ll .mysql_history
-rw------- 1 root root 321 Jun 12 19:58 .mysql_history
確認(rèn)密碼不多后,重新授權(quán)就行


grant all      on wordpress.*       to 'wordpress'@'172.16.1.%'  identified by '123456';
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末帖渠,一起剝皮案震驚了整個濱河市谒亦,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌空郊,老刑警劉巖份招,帶你破解...
    沈念sama閱讀 219,589評論 6 508
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現(xiàn)場離奇詭異渣淳,居然都是意外死亡脾还,警方通過查閱死者的電腦和手機伴箩,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,615評論 3 396
  • 文/潘曉璐 我一進店門入愧,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人嗤谚,你說我怎么就攤上這事棺蛛。” “怎么了巩步?”我有些...
    開封第一講書人閱讀 165,933評論 0 356
  • 文/不壞的土叔 我叫張陵旁赊,是天一觀的道長。 經(jīng)常有香客問我椅野,道長终畅,這世上最難降的妖魔是什么籍胯? 我笑而不...
    開封第一講書人閱讀 58,976評論 1 295
  • 正文 為了忘掉前任,我火速辦了婚禮离福,結(jié)果婚禮上杖狼,老公的妹妹穿的比我還像新娘。我一直安慰自己妖爷,他們只是感情好蝶涩,可當(dāng)我...
    茶點故事閱讀 67,999評論 6 393
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著絮识,像睡著了一般绿聘。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上次舌,一...
    開封第一講書人閱讀 51,775評論 1 307
  • 那天熄攘,我揣著相機與錄音,去河邊找鬼彼念。 笑死鲜屏,一個胖子當(dāng)著我的面吹牛,可吹牛的內(nèi)容都是我干的国拇。 我是一名探鬼主播洛史,決...
    沈念sama閱讀 40,474評論 3 420
  • 文/蒼蘭香墨 我猛地睜開眼,長吁一口氣:“原來是場噩夢啊……” “哼酱吝!你這毒婦竟也來了也殖?” 一聲冷哼從身側(cè)響起,我...
    開封第一講書人閱讀 39,359評論 0 276
  • 序言:老撾萬榮一對情侶失蹤务热,失蹤者是張志新(化名)和其女友劉穎忆嗜,沒想到半個月后,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體崎岂,經(jīng)...
    沈念sama閱讀 45,854評論 1 317
  • 正文 獨居荒郊野嶺守林人離奇死亡捆毫,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 38,007評論 3 338
  • 正文 我和宋清朗相戀三年,在試婚紗的時候發(fā)現(xiàn)自己被綠了冲甘。 大學(xué)時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片绩卤。...
    茶點故事閱讀 40,146評論 1 351
  • 序言:一個原本活蹦亂跳的男人離奇死亡,死狀恐怖江醇,靈堂內(nèi)的尸體忽然破棺而出濒憋,到底是詐尸還是另有隱情,我是刑警寧澤陶夜,帶...
    沈念sama閱讀 35,826評論 5 346
  • 正文 年R本政府宣布凛驮,位于F島的核電站,受9級特大地震影響条辟,放射性物質(zhì)發(fā)生泄漏黔夭。R本人自食惡果不足惜宏胯,卻給世界環(huán)境...
    茶點故事閱讀 41,484評論 3 331
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望本姥。 院中可真熱鬧胳嘲,春花似錦、人聲如沸扣草。這莊子的主人今日做“春日...
    開封第一講書人閱讀 32,029評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽辰妙。三九已至鹰祸,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間密浑,已是汗流浹背蛙婴。 一陣腳步聲響...
    開封第一講書人閱讀 33,153評論 1 272
  • 我被黑心中介騙來泰國打工, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留尔破,地道東北人街图。 一個月前我還...
    沈念sama閱讀 48,420評論 3 373
  • 正文 我出身青樓,卻偏偏與公主長得像懒构,于是被迫代替她去往敵國和親餐济。 傳聞我的和親對象是個殘疾皇子,可洞房花燭夜當(dāng)晚...
    茶點故事閱讀 45,107評論 2 356

推薦閱讀更多精彩內(nèi)容

  • 豆苗爸爸明天會帶媽媽回姥姥姥爺那里了胆剧。 作為新手媽媽絮姆,稍微這幾天都不太舒服。睡的很辛苦秩霍。難受想吐是日常篙悯,下車后就直...
    莫淇閱讀 182評論 0 1
  • 晚上刷微博,看到朋友靜發(fā)了一條“我真的好感動啊”铃绒,就知道是她的男朋友肯定是給她準(zhǔn)備了什么驚喜鸽照,就評論了句“說來...
    解金閱讀 206評論 0 1
  • 【原文】知伯帥趙糠悼、韓届榄、魏而伐范、中行氏倔喂,滅之铝条。休數(shù)年靖苇,使人請地于韓。韓康子欲勿與班缰,段規(guī)諫曰:“不可贤壁。夫知伯之為人也...
    眉間山川閱讀 946評論 0 4
  • 嵇康莹妒,是中國十大美男子之一名船,也是一個第一眼見了就會誤終生的男子。嵇康長相貌美旨怠,文采斐然渠驼。他的才華,令人驚艷鉴腻,也令人...
    雨過天晴_e590閱讀 1,170評論 2 7
  • 堅信是偉大的力量 堅信是進步的砝碼 堅信自我擊敗困難 堅信自我變得從容 堅信自我是墊腳石 堅信自我走向成功 堅信才...
    鐘飄飄閱讀 154評論 0 2