Sudotarxzfvhttpd-2.2.26.tar.gzcdhttpd-2.2.26sudo.configure -- prefixusrlocalapache2 -- enable-modulemost -- enable-rewrite -- enable-sharedmax -- enable-so
Download httpd-2.2.26.tar.gz () and run
sudo tar xzfv httpd-2.2.26.tar.gz cd httpd-2.2.26sudo ./configure --prefix=/usr/local/apache2 --enable-module=most --enable-rewrite --enable-shared=max --enable-so
If the following error is prompted:
checking for C compiler default output file name... configure: error: C compiler cannot create executables
The reason is that the libc6-dev is not installed, run
sudo apt-get install build-essential
OK.
Then run the following command again:
sudo ./configure --prefix=/usr/local/apache2 --enable-module=most --enable-rewrite --enable-shared=max --enable-so
If no error is reported, run
sudo makesudo make installsudo groupadd apachesudo useradd -g apache apachesudo passwd apachesudo chown -R apache:apache /usr/local/apache2
Modify the apache configuration file and run
sudo vi /usr/local/apache2/conf/httpd.conf
Find
User nobodyGroup #-1
Modify
User apacheGroup apache
Find
#ServerName www.example.com:80
Change
ServerName *:80
Save!
Execute command
sudo /usr/local/apache2/bin/apachectl start
Start apache.
Open a browser and access http: // localhost
If everything goes well, you can see the apache test page. Congratulations! apache has been installed!
The commands for restarting and disabling the apache service are:
sudo /usr/local/apache2/bin/apachectl restartsudo /usr/local/apache2/bin/apachectl stop