Iwu bara uru iji jikwaa sava webụ Apache na Linux


N'ime nkuzi a, anyị ga-akọwa ụfọdụ iwu njikwa ọrụ Apache (HTTPD) a na-ejikarị eme ihe nke ị kwesịrị ịma dị ka onye nrụpụta ma ọ bụ onye nchịkwa sistemụ na ị ga-edebe iwu ndị a n'aka gị. Anyị ga-egosi iwu maka ma Systemd na SysVinit.

Jide n'aka na, a ga-egburịrị iwu ndị a dị ka mgbọrọgwụ ma ọ bụ onye ọrụ sudo ma rụọ ọrụ na nkesa Linux ọ bụla dị ka CentOS, RHEL, Fedora Debian, na Ubuntu.

Wụnye ihe nkesa Apache

Ka ịwụnye sava weebụ Apache, jiri njikwa ngwungwu nkesa ndabere gị dịka egosiri.

$ sudo apt install apache2	    [On Debian/Ubuntu]
$ sudo yum install httpd	    [On RHEL/CentOS]
$ sudo dnf install httpd	    [On Fedora 22+]
$ sudo zypper install apache2	    [On openSUSE]

Lelee ụdị Apache

Ka ịlele ụdị arụnyere nke sava weebụ Apache gị na sistemụ Linux gị, mee iwu a.

$ sudo httpd -v
OR
$ sudo apache2 -v
Server version: Apache/2.4.6 (CentOS)
Server built:   Nov  5 2018 01:47:09

Ọ bụrụ na ịchọrọ igosipụta nọmba ụdị Apache wee chịkọta ntọala, jiri ọkọlọtọ -V dị ka egosiri.

$ sudo httpd -V
OR
$ sudo apache2 -V
Server version: Apache/2.4.6 (CentOS)
Server built:   Nov  5 2018 01:47:09
Server's Module Magic Number: 20120211:24
Server loaded:  APR 1.4.8, APR-UTIL 1.5.2
Compiled using: APR 1.4.8, APR-UTIL 1.5.2
Architecture:   64-bit
Server MPM:     prefork
  threaded:     no
    forked:     yes (variable process count)
Server compiled with....
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D APR_USE_SYSVSEM_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D DYNAMIC_MODULE_LIMIT=256
 -D HTTPD_ROOT="/etc/httpd"
 -D SUEXEC_BIN="/usr/sbin/suexec"
 -D DEFAULT_PIDLOG="/run/httpd/httpd.pid"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="conf/mime.types"
 -D SERVER_CONFIG_FILE="conf/httpd.conf"

Lelee mperi nhazi nhazi Apache

Iji lelee faịlụ nhazi Apache gị maka njehie syntax ọ bụla na-eme iwu na-esonụ, nke ga-elele izi ezi nke faịlụ nhazi ahụ, tupu ịmalitegharịa ọrụ ahụ.

$ sudo httpd -t
OR
$ sudo apache2ctl -t
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using linux-console.net. 
Set the 'ServerName' directive globally to suppress this message
Syntax OK

Malite Ọrụ Apache

Iji malite ọrụ Apache, mee iwu a.

------------ On CentOS/RHEL ------------ 
$ sudo systemctl start httpd     [On Systemd]
$ sudo service httpd start 	 [On SysVInit]

------------ On Ubunt/Debian  ------------
$ sudo systemctl start apache2   [On Systemd]
$ sudo service apache2 start     [On SysVInit]

Kwado ọrụ Apache

Iwu gara aga na-amalite naanị ọrụ Apache maka ugbu a, iji mee ka ọ malite na-akpaghị aka na buut sistemụ, mee iwu a.

------------ On CentOS/RHEL ------------ 
$ sudo systemctl enable httpd     [On Systemd]
$ sudo chkconfig httpd on 	  [On SysVInit]

------------ On Ubunt/Debian  ------------
$ sudo systemctl enable apache2   [On Systemd]
$ sudo chkconfig apache2 on       [On SysVInit]

Malitegharịa ọrụ Apache

Ka ịmalitegharịa Apache (kwụsị wee malite ọrụ), mee iwu na-esonụ.

------------ On CentOS/RHEL ------------ 
$ sudo systemctl restart httpd     [On Systemd]
$ sudo service httpd restart 	   [On SysVInit]

------------ On Ubunt/Debian  ------------
$ sudo systemctl restart apache2   [On Systemd]
$ sudo service apache2 restart     [On SysVInit]

Lelee Ọnọdụ Ọrụ Apache

Iji lelee ozi ọnọdụ oge ọrụ Apache, gbasoo iwu a.

------------ On CentOS/RHEL ------------ 
$ sudo systemctl status httpd     [On Systemd]
$ sudo service httpd status 	  [On SysVInit]

------------ On Ubunt/Debian  ------------
$ sudo systemctl status apache2   [On Systemd]
$ sudo service apache2 status     [On SysVInit]

Bugharịa Ọrụ Apache

Ọ bụrụ na ịmeela mgbanwe ọ bụla na nhazi ihe nkesa Apache, ị nwere ike ịkụziri ọrụ ahụ ka ọ bugharịa nhazi ya site na ịme iwu na-esonụ.

------------ On CentOS/RHEL ------------ 
$ sudo systemctl reload httpd     [On Systemd]
$ sudo service httpd reload 	  [On SysVInit]

------------ On Ubunt/Debian  ------------
$ sudo systemctl reload apache2   [On Systemd]
$ sudo service apache2 reload     [On SysVInit]

Kwụsị Ọrụ Apache

Ka ịkwụsị ọrụ Apache, jiri iwu a.

------------ On CentOS/RHEL ------------ 
$ sudo systemctl stop httpd       [On Systemd]
$ sudo service httpd stop 	  [On SysVInit]

------------ On Ubunt/Debian  ------------
$ sudo systemctl stop apache2     [On Systemd]
$ sudo service apache2 stop     [On SysVInit]

Gosi Enyemaka Iwu Apache

N'ikpeazụ ma ọ dịghị ihe ọzọ, ị nwere ike nweta enyemaka gbasara iwu ọrụ Apache n'okpuru systemd site na iji iwu na-esonụ.

$ sudo httpd -h
OR
$ sudo apache2 -h		
OR
$ systemctl -h apache2	
Usage: httpd [-D name] [-d directory] [-f file]
             [-C "directive"] [-c "directive"]
             [-k start|restart|graceful|graceful-stop|stop]
             [-v] [-V] [-h] [-l] [-L] [-t] [-T] [-S] [-X]
Options:
  -D name            : define a name for use in  directives
  -d directory       : specify an alternate initial ServerRoot
  -f file            : specify an alternate ServerConfigFile
  -C "directive"     : process directive before reading config files
  -c "directive"     : process directive after reading config files
  -e level           : show startup errors of level (see LogLevel)
  -E file            : log startup errors to file
  -v                 : show version number
  -V                 : show compile settings
  -h                 : list available command line options (this page)
  -l                 : list compiled in modules
  -L                 : list available configuration directives
  -t -D DUMP_VHOSTS  : show parsed vhost settings
  -t -D DUMP_RUN_CFG : show parsed run settings
  -S                 : a synonym for -t -D DUMP_VHOSTS -D DUMP_RUN_CFG
  -t -D DUMP_MODULES : show all loaded modules 
  -M                 : a synonym for -t -D DUMP_MODULES
  -t                 : run syntax check for config files
  -T                 : start without DocumentRoot(s) check
  -X                 : debug mode (only one worker, do not detach)

Ị nwere ike ịchọta ozi ndị ọzọ gbasara systemctl site na nyocha: Otu esi ejikwa 'Systemd' Services na Units Iji 'Systemctl' na Linux.

Ị nwekwara ike ịmasị ịgụ akụkọ Apache ndị a na-eso.

  1. Ndụmọdụ 5 iji kwalite arụmọrụ nke sava webụ Apache gị
  2. Otu esi eleba anya n'ibu sava webụ Apache na ọnụ ọgụgụ ibe
  3. Otu esi ahazi sava webụ Apache Iji\Apache GUI Ngwa
  4. Etu esi agbanwe ọdụ ụgbọ mmiri Apache HTTP na Linux
  5. 13 Ndụmọdụ nchekwa na ime ihe ike
  6. Chebe Apache megide Brute Force ma ọ bụ mwakpo DDoS Iji Mod_Security na Mod_evasive Modules

Nke ahụ bụ ihe niile ugbu a! N'isiokwu a, anyị akọwaala iwu njikwa ọrụ Apache/HTTPD a na-ejikarị eme ihe, gụnyere ịmalite, inye aka, ịmalitegharị na ịkwụsị Apache. Ị nwere ike ịbịakwute anyị mgbe niile site na mpempe nzaghachi n'okpuru maka ajụjụ ma ọ bụ nkwupụta ọ bụla.