Txoj kev pom tseeb tshaj plaws los tiv thaiv nplooj ntawv los ntawm cov neeg tuaj ncig tsis xav pom yog tsim lub zais nkag. Qhov no tuaj yeem ua ob qho tib si los ntawm kev siv ib qho twg ntawm cov lus sau scripting, thiab los ntawm cov qauv txhais tau ntawm Apache web server. Qhov kev xaiv thib ob tsis xav tau kev paub txog cov lus programming, yog li peb yuav xav txog kev tiv thaiv nplooj ntawv siv cov peev txheej ntawm lub web server.
Cov Lus Qhia
Kauj ruam 1
Ua ntej, tsim ib kem cais ntawm tus neeg rau zaub mov rau cov nplooj ntawv los tiv thaiv, thiab tshem tag nrho cov nplooj ntawv tiv thaiv muaj. Yog tias txhua nplooj ntawv ntawm lub xaib muaj kev tiv thaiv, tom qab ntawv no tuaj yeem hla tau.
Kauj ruam 2
Lub tais ceev tseg yuav tsum muaj cov ntawv sau npe hu ua.htaccess uas muaj cov lus qhia rau lub web server. Cov software software, thaum thov daim ntawv los ntawm cov ntawv tais ceev tseg (nplooj ntawv web lossis lwm cov ntawv), yuav ua raws li cov lus qhia los ntawm.htaccess. Nws yuav tsum muaj cov lus qhia yuav tsum ua tus qhua uas tsis tau tso cai kom nkag mus rau lub npe siv thiab tus password. Tsim ib daim ntawv khoob ntawm txhua cov ntawv kho (cov qauv lus tseem ceeb) zoo thiab nkag mus rau cov lus qhia nram qab no rau hauv nws: AuthType Basic
AuthName "Nplooj ntawv no yog tiv thaiv!"
AuthUserFile /usr/your_host/your_site/.htpasswd
xav kom siv tau-tus neeg siv thawj kab (AuthType Basic) qhia tus neeg rau zaub mov tias cov ntaub ntawv rau qhov no thiab txhua subfolders yuav tsum tsuas yog muab rau tus qhua raug cai. ntawm cov foos tso npe nkag thiab nkag tus password. Nkag mus rau kab ntawv uas koj xav tau yam tsis siv quotes ("). Kab thib peb (AuthUserFile /usr/your_host/your_site/.htpasswd) muaj txoj hauv kev rau cov ntawv uas khaws logins thiab password rau kev tso cai rau cov neeg tuaj saib. Qhov no yuav tsum yog" txoj hauv kev "- los ntawm cov cag ntoo ntawm koj tus lej ntawm cov neeg rau zaub mov uas taw qhia tag nrho cov npe tsob ntoo. On lub vev xaib hosting cov chaw hauv Is Taws Nem, feem ntau nws zoo li / pub / tsev / account_name / folder_name / file_name. Txoj kev tag nrho rau koj lub xaib los ntawm cov cag tuaj yeem Koj tuaj yeem nrhiav nws tawm hauv cov thawj coj tswj hwm ntawm lub xaib. Koj tuaj yeem pom tawm, piv txwv, siv phpinfo () cov lus txib ntawm PHP lus, lossis yooj yim los ntawm kev nug kev txhawb nqa ntawm koj lub vev xaib plaub kab (yuav tsum siv tau-tus neeg siv) muaj qhov cim tias tsis muaj dab tsi tab sis qhov tseeb khub ntawm tus ID nkag mus / lo lus zais rau kev nkag mus rau cov ntaub ntawv hauv phau ntawv no tsis tas yuav los ntawm tus qhua. Hauv ntau cov ntawv nyuab, cov lus qhia no muaj peev xwm qhia qhov kev tseev kom muaj uas tus neeg siv (ntau dua precisely, nws tus ID nkag mus) muaj Tej pab pawg tshwj xeeb. Piv txwv li, koj tuaj yeem faib cov neeg siv rau hauv cov tswj hwm thiab cov neeg siv zoo. Txhua pawg neeg no tuaj yeem muaj cai sib txawv los mus saib cov ntawv hauv cov ntawv sau sib txawv.
Kauj ruam 3
Txuag tsim cov ntaub ntawv tsim ua.htaccess. Txhawm rau tiv thaiv cov ntawv xov xwm los ntawm cia li muab qhov txuas ntxiv.txt thaum txuag ntawv, xaiv qhov "Txhua yam ntaub ntawv" rau hauv "Cov hom ntaub ntawv" xa mus nyob rau ntawm daim ntawv sau tseg.
Kauj ruam 4
Cov ntaub ntawv muaj cov lus zais rau tso cai rau cov neeg qhua feem ntau yog npe ".htpasswd", tab sis qhov no tsis yog txoj cai yuav tsum ua - koj tuaj yeem muab lwm lub npe rau tib yam. Txhawm rau tsim cov ntaub ntawv no koj yuav tsum siv cov haujlwm tshwj xeeb hu ua htpasswd.exe. Qhov no yog qhov tsim nyog vim tias cov passwords hauv cov ntaub ntawv khaws cia hauv cov ntawv tshwj xeeb "encrypted" - qhov no yog qhov program ua los ntawm kev tsim cov ntawv.htpasswd. Yog tias Apache server tau nruab rau hauv koj lub khoos phis tawm, koj tuaj yeem nqa qhov program ntawm usrlocalapachein nplaub tshev, yog tias tsis yog - piv txwv, ntawm no - https://www.intrex.net/techsupp/htpasswd.exe Khiav cov ntawv cim hluav taws xob ntawm tshuab hluav taws xob los ntawm cov kab hais kom ua. Hauv Windows XP nws yooj yim los ua nws zoo li qhov no: tso htpasswd.exe hauv cais tsim cov ntawv tais ceev tseg, nyem txoj cai rau daim nplaub tshev thiab xaiv "Run command line here" los ntawm cov ntawv qhia zaub mov uas tshwm. Nyob rau hauv kab hais kom ua kab davhlau ya nyob twg, nkag mus: htpasswd -cm.htpasswd user_1htpasswd ntawm no yog lub npe ntawm qhov kev pab cuam los khiav; -cm yog kev hloov kho uas qhia tias yuav tsum tsim ib lo lus zais tshiab;; user_1 yog lub npe zais ntawm tus neeg siv uas yuav raug ntxiv rau cov ntaub ntawv tshiab Nias Sau thiab koj yuav kom koj nkag mus thiab lees paub tus password rau user_1. Tom qab nkag mus thiab lees paub cov password, qhov program yuav tsim.htpasswd ntawv hauv nws daim nplaub tshev uas muaj ib tus ID nkag mus / tus password txuas. cm hloov kho, nkag rau nkaus xwb -m. Nws yog qhov ua tau nyeem qhov kev pabcuam ncaj ncees ntawm kev pabcuam htpasswd.exe, yog tias koj nkag: htpasswd.exe /
Kauj ruam 5
Rub tawm ob qho tib si tsim cov ntaub ntawv (.htaccess thiab.htpasswd) rau tus neeg rau zaub mov ntawm koj lub xaib los ntawm cov ntaub ntawv tus thawj tswj hwm pawg tswj hwm lossis lwm tus neeg siv FTP. Htaccess cov ntaub ntawv yuav tsum muab tso rau hauv cov ntawv khaws cia tib qhov chaw uas muaj cov nplooj ntawv tiv thaiv. Thiab.htpasswd ntawv yuav tsum muab khaws cia rau hauv daim nplaub tshev, txoj hauv kev uas koj nkag rau nws hauv htaccess. Raws li txoj cai, lo lus zais cov ntaub ntawv khaws cia nyob rau hauv ib phau ntawv qhia npe nyob rau theem ib theem saum tus cag ntawv hauv lub xaib. Qhov no ua tiav kom cov ntaub ntawv nkag tsis tau hauv Is Taws Nem.