Cov txheej txheem:

Txhim kho Apache2 ntawm Ubuntu Server: 4 Cov Kauj Ruam
Txhim kho Apache2 ntawm Ubuntu Server: 4 Cov Kauj Ruam

Video: Txhim kho Apache2 ntawm Ubuntu Server: 4 Cov Kauj Ruam

Video: Txhim kho Apache2 ntawm Ubuntu Server: 4 Cov Kauj Ruam
Video: ЗАПРЕЩЁННЫЕ ТОВАРЫ с ALIEXPRESS 2023 ШТРАФ и ТЮРЬМА ЛЕГКО! 2024, Lub Xya hli ntuj
Anonim
Txhim kho Apache2 ntawm Ubuntu Server
Txhim kho Apache2 ntawm Ubuntu Server
Txhim kho Apache2 ntawm Ubuntu Server
Txhim kho Apache2 ntawm Ubuntu Server

Txhim kho Apache2 ntawm Ubuntu server yuav ua rau koj muaj hwj chim los tswj hwm koj tus kheej lub vev xaib. Koj tuaj yeem siv qhov no rau koj tus kheej siv, lag luam, lossis txawm tias kev txhim kho web.

Kauj ruam 1: Kev teeb tsa

Apache tau suav nrog hauv Ubuntu lub pob ntawv thov tsis raug, yog li tsis muaj cov cuab yeej tshwj xeeb lossis txheej txheem xav tau los nruab nws. Peb tuaj yeem hloov kho thiab teeb tsa pob ncaj qha los ntawm Ubuntu. Pib tawm los ntawm kev nkag mus rau hauv koj lub server thiab hloov kho apt.

sudo apt-tau hloov tshiab

Qhov no yuav hloov kho lub pob cache yuav tag nrho cov pob khoom tam sim no muaj. Thaum hloov kho tshiab, mus tom ntej thiab teeb tsa Apache2.

sudo apt-tau nruab apache2

Qhov kev teeb tsa no yuav teeb tsa Apache2 ntxiv rau ib qho kev cia siab uas ploj lawm, yog li nco ntsoov lees txais ib qho uas yuav tshwm sim thaum txheej txheem teeb tsa. Thaum ua tiav, Apache2 tau teeb tsa, txawm li cas los xij muaj kev teeb tsa me ntsis ntxiv xav tau txhawm rau ua kom nws mus.

Kauj ruam 2: Kho lub Firewall

Ubuntu muaj lub Default Firewall hu ua ufw uas yog txwv tsis pub tawm ntawm lub thawv. Peb yuav xav qhib nws kom tso cai kev sib txuas lus mus rau/los ntawm Apache lub web server. Siv cov lus txib hauv qab no los qhib lub firewall. UFW muaj lub neej ntawd Apache profile ua hauv.

sudo ufw tso cai 'Apache Full'

Lossis koj tuaj yeem xaiv ua nws tus kheej los ntawm chaw nres nkoj.

sudo ufw tso cai 80

sudo ufw tso cai 443

Kauj Ruam 3: Txheeb Xyuas Server

Thaum Apache tau teeb tsa thiab lub firewall tau qhib, koj tuaj yeem tshawb xyuas qhov xwm txheej ntawm tus neeg rau zaub mov thawj zaug. Siv cov lus txib hauv qab no kom ntseeg tau tias qhov kev pabcuam tau ua haujlwm tiag tiag.

sudo kev pabcuam apache2 xwm txheej

Yog tias qhov kev pabcuam tau ua haujlwm zoo, koj yuav tsum pom qhov xwm txheej ntawm "RUNNING". Yog tias tsis yog, tshaj tawm "pib" hais kom ua tsis yog "xwm txheej" hais kom pib nws. Tam sim no tus neeg rau zaub mov tab tom khiav, koj tuaj yeem tsoo tus neeg rau zaub mov los ntawm hostname lossis IP los saib lub vev xaib Apache lub neej ntawd.

hostname lub npe

los yog

ifconfig

Thaum koj tau sau tag nrho lub npe hostname lossis tus IP chaw nyob ntawm lub vev xaib, qhib koj lub browser thiab mus rau qhov URL uas lub vev xaib tau mloog piv txwv.

hostname lossis https:// hostname lossis https:// hostname lossis https:// hostname

Kauj ruam 4: Default Config/Log Locations

Apache muaj ob peb qhov chaw pib rau khaws cia lossis nyeem cov ntawv. Koj yuav tsum tau poke ib ncig ntawm koj lub server me ntsis kom tau txais qhov dai ntawm yam, tab sis qhov ua tsis tau zoo rau Ubuntu feem ntau ntawm cov chaw hauv qab no

Web cov ntaub ntawv -/var/www/html/

Kho Cov Ntaub Ntawv

/etc/apache2/apache2.conf /etc/apache2/sites-available/000-default.conf

Cov cav -/var/cav/apache2

Pom zoo: