Home > Backend Development > PHP Tutorial > Compile and install apache2.2.26 using source code under ubuntu

Compile and install apache2.2.26 using source code under ubuntu

伊谢尔伦
Release: 2016-11-25 16:00:19
Original
992 people have browsed it

Download httpd-2.2.26.tar.gz (download address), execute

sudo tar xzfv httpd-2.2.26.tar.gz 
cd  httpd-2.2.26
sudo ./configure --prefix=/usr/local/apache2 --enable-module=most --enable-rewrite --enable-shared=max --enable-so
Copy after login

If the following error is prompted:

checking for C compiler default output file name... configure: error: C compiler cannot create executables
Copy after login

The reason is that libc6-dev is not installed, execute

sudo apt-get install build-essential
Copy after login

and it will be ok.

Then re-execute:

sudo  ./configure --prefix=/usr/local/apache2 --enable-module=most --enable-rewrite --enable-shared=max --enable-so
Copy after login

no error is reported, then execute

sudo make
sudo make install
sudo groupadd apache
sudo useradd -g apache apache
sudo passwd apache
sudo chown -R apache:apache /usr/local/apache2
Copy after login

to modify the apache configuration file, execute

sudo vi /usr/local/apache2/conf/httpd.conf
Copy after login

to find

User nobody
Group #-1
Copy after login

and change it to

User apache
Group apache
Copy after login

find

#ServerName www.example.com:80
Copy after login

and change it to

ServerName *:80
Copy after login

Save!

Execute the command

sudo /usr/local/apache2/bin/apachectl start
Copy after login

Start apache.

Open the browser and visit http://localhost

If everything goes well, you should be able to see the apache test page. Congratulations, apache is installed!

The commands to restart and shut down the apache service are:

sudo /usr/local/apache2/bin/apachectl restart
sudo /usr/local/apache2/bin/apachectl stop
Copy after login


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template