Download dependencies:
wget https://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-1.6.5.tar.gz wget https://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-util-1.6.1.tar.gz
Download httpd
wget
Install build dependencies:
yum install gcc gcc-c++ libxml2-devel bzip2-devel libmcrypt-devel openssl-devel\ libcurl-devel libjpeg-devel libpng-devel freetype-devel readline-devel libxslt-devel\ perl-devel psmisc.x86_64 recode-devel libtidy-devel expat-devel curl-devel -y
Decompression dependencies and compiler installation
tar -zxf apr-1.6.5.tar.gz CD apr-1.6.5 ./configure --prefix=/usr/local/apr-1.6.5 make && make install
tar -zxf apr-util-1.6.1.tar.gz April cd-util-1.6.1 ./configure --prefix=/usr/local/apr-util-1.6.1 --with-apr=/usr/local/apr-1.6.5 make && make install
Unpack and compile and install httpd:
tar -zxf httpd-2.4.38.tar.gz ./configure --prefix=/usr/local/http-2.4.41 --sysconfdir=/usr/local/http-2.4.41/etc\ --enable-so --enable-ssl --enable-cgi --enable-rewrite --enable-modules=most\ --enable-mpms-shared=all --with-mpm=prefork --with-zlib --with-pcre\ --with-apr=/usr/local/apr-1.6.5 --with-apr-util=/usr/local/apr-util-1.6.1 make&&make install
Start httpd
./usr/local/http-2.4.41/bin/apachectl start
Troubleshoot startup ServerName reported error
cd /usr/local/http-2.4.41/etc # # ServerName gives the name and port that the server uses to identify itself. # This can often be determined automatically, but we recommend you specify # it explicitly to prevent problems during startup. # # If your host doesn't have a registered DNS name, enter its IP address here. # #ServerName www.example.com:80 ServerName www.example.com:80
Multi-site configuration port visit
1. Modify httpd.conf # DocumentRoot: The directory out of which you will serve your # documents. By default, all requests are taken from this directory, but # symbolic links and aliases may be used to point to other locations. # DocumentRoot "/usr/share/http" <Directory "/usr/share/http"> 2. Allowoverri modified to All # AllowOverride controls what directives may be placed in .htaccess files. # It can be "All", "None", or any combination of the keywords: # AllowOverride FileInfo AuthConfig Limit AllowOverride None # amended to All # Controls who can get stuff from this server. Require all granted 3. Release the virtual hosts # Virtual hosts #Include etc/extra/httpd-vhosts.conf Include etc/extra/httpd-vhosts.conf
Modify httpd-vhost.conf
we /usr/local/http-2.4.41/etc/extra/httpd-vhost.conf <VirtualHost *:8081> ServerAdmin [email protected] DocumentRoot "/usr/share/http/shop" ServerName dummy-host.example.com ServerAlias www.dummy-host.example.com ErrorLog "logs/shop-error_log" CustomLog "logs/shop-access_log" common </VirtualHost> <VirtualHost *:8082> ServerAdmin [email protected] DocumentRoot "/usr/share/http/blog" ServerName dummy-host2.example.com ErrorLog "logs/blog-error_log" CustomLog "logs/blog-access_log" common </VirtualHost>