EverKB

Knowledge Base Ever

Sastavite i instalirajte Apache 2.4 na CentOS7

2019-11-15 12:18:53

oznaka: CentOS, Apache, CentOS7, Apache2.4, Compiling Apache, Sastavi Apache httpd2.4

CentOS7 dolazi s uslugom Apache httpd (u daljnjem tekstu httpd). Ako ovu uslugu ne uključite na svoj stroj, možete je koristiti yum da biste je instalirali.

Ako trebate instalirati novu verziju httpd, poput httpd2.4, morate je sastaviti sami. Postupak sastavljanja nije kompliciran, potrebno je sastaviti i instalirati samo ovisne pakete, što cijeli postupak čini donekle kompliciranim.

Deinstalirajte staru verziju, instalirajte alat za sastavljanje i deinstalirajte staru verziju instalacijskog paketa

yum -y remove httpd

yum -y install gcc gcc-c++
yum -y group install "Development Tools"

yum -y remove apr apr-devel apr-util apr-util-devel

Instalirajte apr

cd /usr/local/src/
yum -y install wget
wget http://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-1.7.0.tar.gz
tar xf apr-1.7.0.tar.gz
cd apr-1.7.0
./configure --prefix=/usr/local/apr
make && make install

Instalirajte apr-util

yum -y install expat-devel

cd /usr/local/src/
wget http://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-util-1.6.1.tar.gz
tar xf apr-util-1.6.1.tar.gz 
cd apr-util-1.6.1
./configure --prefix=/usr/local/apr-util -with-apr=/usr/local/apr/bin/apr-1-config 
make && make install

Instalirajte pcre

cd /usr/local/src/
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.43.tar.gz
tar xf pcre-8.43.tar.gz 
cd pcre-8.43
./configure --prefix=/usr/local/pcre  
make && make install

Sastavite httpd

cd /usr/local/src/
wget http://mirror.bit.edu.cn/apache//httpd/httpd-2.4.39.tar.gz
tar xf httpd-2.4.39.tar.gz
cd httpd-2.4.39
./configure --prefix=/usr/local/apache --enable-rewrite --enable-so --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre
make && make install

Uredite konfiguracijsku datoteku /etc/init.d/httpd, konfigurirajte systemctl za početak

#!/bin/bash
# chkconfig: 12345 80 90
function start_http()
{
    /usr/local/apache/bin/apachectl start
}
function stop_http()
{
    /usr/local/apache/bin/apachectl stop
}
case "$1" in
start)
    start_http
;;
stop)
    stop_http
;;
restart)
    stop_http
    start_http
;;
*)
    echo "Usage : start | stop | restart"
;;
esac

Postavite izvršne dozvole, pokrenite uslugu i postavite je za dizanje prilikom dizanja

chmod a+x /etc/init.d/httpd
systemctl daemon-reload
systemctl start httpd
chkconfig --add httpd

oznaka

CentOS7 CentOS PHP Linux Python3 Python MySQL YUM JavaScript MariaDB Redis MySQL8 caching_sha2_password HTML mysql_native_password PHP7 CSS SOCKS Web Development data INDENTIFIED BY password policy requirements SVN Fedora Media Writer msodbcsql Redis5 SQLAlchemy absolute Deepin jemalloc Shadowsocks toggle convert FuelPHP mysqlclient ss5.passwd at-symbol Error Control Operator margin PHPUnit Framework SOCKET vps daemon process IIS password sudoers center Fatal Errors MongoDB4 SQL Server 2017 WiFi .htaccess DATE_SUB Phalcon TestCase Compiling PHP frequency conflict set_error_handler ss5.conf apr Elasticsearch7.3 PHPUnit Slim Vincent Garreau daemon HTTP particles.js Sudo Failed to build these modules: _uuid MongoDB SQL Server width DATE_ADD ip command pg_bha.conf Tcp BBR Compiling Apache Frameworks MySQL-python scrollbar ss5-3.8.9 Apache2.4 Elasticsearch libpython3.7m.so.1.0 PHPStorm show VIM CURLOPT_POSTFIELDS NodeJs substr Bluetooth Failed to build these modules: _ctypes Minimal ISO SQL Date Funcitons Wi-Fi date sub INTERVAL PECL Tag Cloud CodeIgniter font-size root ss5 apache httpd dual network interfaces Laravel ShadowsocksR vertical-align CURLFille horiz-align node.js SUBDATE BarManager exec mb_substr PyCharm SOCKS5 Proxy Server WebStorm date add IntelliJIDEA PEAR Tag Chrome find remi src Apache du jQuery PHP5.5 Shadowsocks-Python V2Ray cURL hide nginx sub folder availability eth0 MariaDB10.4 PostgreSQL SOCKS5 Web Server date Install MongoDB pdo_sqlsrv Symfony File Upload mssql-tools register_shutdown_function sqlsrv Zend Framework ADDDATE DevExpress JetBrain php-fpm Shadowsocks-Libev unixODBC-devel height network interface string Aura error_get_last Port 80