[root@localhost ~]# yum -y install pcre-devel expat-devel gcc gcc-c++
root@localhost ~]# tar -xzf apr-util-1.6.1.tar.gz
[root@localhost ~]# tar -xzf httpd-2.4.39.tar.gz
[root@localhost ~]# cd apr-1.7.0/
[root@localhost apr-1.7.0]# ./configure --prefix=/usr/local/apr
[root@localhost apr-1.7.0]# make -j4
[root@localhost apr-1.7.0]# make install
[root@localhost apr-1.7.0]# ls /usr/local/apr/
bin build-1 include lib
[root@localhost apr-1.7.0]# cd /root/apr-util-1.6.1/
[root@localhost apr-util-1.6.1]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
[root@localhost apr-util-1.6.1]# make -j4
[root@localhost apr-util-1.6.1]# make install
[root@localhost apr-util-1.6.1]# ls /usr/local/apr-util/
bin include lib
[root@localhost apr-util-1.6.1]# cd /root/httpd-2.4.39/
[root@localhost httpd-2.4.39]# ./configure --prefix=/usr/local/apache --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-so --enable-mods-shared=most
[root@localhost httpd-2.4.39]# make -j4
[root@localhost httpd-2.4.39]# make install
[root@localhost httpd-2.4.39]# ls /usr/local/apache/
bin cgi-bin error icons logs manual
build conf htdocs include man modules
[root@localhost httpd-2.4.39]# cd /usr/local/apache/
[root@localhost apache]# ./bin/apachectl start
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message 启动时给出提示:需要到主配置文件添加一个域名即可
[root@localhost apache]# ./bin/httpd -l
Compiled in modules:
core.c
mod_so.c
http_core.c
event.c 查看apache的工作模式event.c模式
Nginx源码编译
[root@localhost ~]# yum -y install gcc gcc-c++ pcre-devel openssl-devel zlib-devel
[root@localhost ~]# tar -xzf nginx-1.15.4.tar.gz
[root@localhost ~]# cd nginx-1.15.4/
[root@localhost nginx-1.15.4]# useradd -M -s /sbin/nologin nginx
[root@localhost nginx-1.15.4]# ./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_ssl_module --with-http_stub_status_module --with-http_gzip_static_module
[root@localhost nginx-1.15.4]# make -j4
[root@localhost nginx-1.15.4]# make install
[root@localhost nginx-1.15.4]# ls /usr/local/nginx/
conf html logs sbin
[root@localhost nginx-1.15.4]# ln -s /usr/local/nginx/sbin/* /usr/sbin/
[root@localhost nginx-1.15.4]# vim /etc/init.d/nginx nginx启动脚本
[root@localhost nginx-1.15.4]# chmod +x /etc/init.d/nginx
[root@localhost nginx-1.15.4]# chkconfig --add nginx
[root@localhost nginx-1.15.4]# service nginx start
[root@localhost nginx-1.15.4]# nginx -t nginx语法检测
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
[root@localhost nginx-1.15.4]# nginx nginx启动
[root@localhost nginx-1.15.4]# killall -s HUP nginx
<?php$conn=newmysqli("127.0.0.1","root","123.com","test");if(!$conn)die("connect error:".mysqli_connect_error());elseecho"connect mysql server successfully\n"?>
[root@localhost ~]# tar -xf apr-1.7.0.tar.gz [root@localhost ~]# tar -xf apr-util-1.6.1.tar.gz [root@localhost ~]# tar -xf httpd-2.4.39.tar.gz [root@localhost ~]# cd apr-1.7.0/[root@localhost apr-...