Ubuntu configure Apache

**System environment: **Ubuntu 10.10 (linux-kernel 2.6.35-22)

**Installed version: **httpd-2.4.2.tar.gz (Official website: Apache httpd)

installation steps:

1、 Download httpd

Download httpd-2.4.2.tar.gz (Official website: Apache httpd)

2、 Unzip httpd

tar -zxvf httpd-2.4.2.tar.gz

3、 Install httpd

Enter the unzipped directory

cd httpd-2.4.2

Create /opt/httpd-2.4.2-server

sudo mkdir -p /opt/httpd-2.4.2-server

Install to the specified directory /opt/httpd-2.4.2-server

sudo ./configure --prefix=/opt/httpd-2.4.2-server/  --enable-module=so

In the picture above, an APR not found error appears!

During the installation of Apache, the errors encountered in turn and the solutions are as follows:

**Question 1: **APR not found

a. Download apr-1.4.6.tar.gz(Official Website)

b, unzip apr

tar -zxvf apr-1.4.6.tar.gz

cd apr-1.4.6

c, install apr

sudo mkdir -p /opt/apr

sudo ./configure --prefix=/opt/apr

sudo make

sudo make install

**Question 2: **APR-util not found

a. Download apr-util-1.4.1.tar.gz(Official Website)

b, unzip apr-util

tar -zxvf apr-util-1.4.1.tar.gz

cd apr-util-1.4.1

c, install apr

sudo mkdir -p /opt/apr-util

sudo ./configure --prefix=/opt/apr-util --with-apr=/opt/apr

sudo make

sudo make install

**Question 3: **pcre-config for libpcre not found

a. Download pcre-8.31.tar.gz(Official Website)

b, decompress pcre

tar -zxvf pcre-8.31.tar.gz

cd pcre-8.31

c, install apr

sudo mkdir -p /opt/pcre

sudo ./configure --prefix=/opt/pcre

sudo make

sudo make install

**Question 4: **Recompile after clean-up compilation

sudo make clean; make

sudo make clean install

After completing the above preparations, install httpd again (with parameters):

sudo ./configure --prefix=/opt/httpd-2.4.2-server/  --enable-module=all --with-apr=/opt/apr --with-apr-util=/opt/apr-util --with-pcre=/opt/pcre

sudo make

sudo make install

Start apache manually

sudo  ./bin/apachectl  start            // stop, restart

4、 Verify that the installation was successful

1 ) Open the browser and enter http://localhost or http://localhost:80 (httpd default port is 80)

The configuration is successful!

Ubuntu installation php steps, please refer to my blog Linux build discuz forum

2 ) Open index.php for verification

Copy php.ini: sudo cp php.ini-development /opt/php-5.4.15-server/lib/

Modify apache httpd.conf: sudo vi /opt/httpd-2.4.2-server/conf/httpd.conf, add the following two lines under AddType application/x-gzip .gz .tgz:

AddType application/x-httpd-php .php
       AddType application/x-httpd-php-source .phps

The red box in the figure below:

In the /opt/httpd-2.4.2-server/htdocs/ directory, create a new file index.php: sudo vi /opt/httpd-2.4.2-server/htdocs/index.php

[ php]view plaincopyprint?

  1. phpinfo();
  2. ?>

In the browser, enter the URL: http://localhost/index.php, open the following page, indicating that the PHP configuration is successful

5、 Configure automatic startup after boot

  1. Copy /usr/server/apache2/bin/apachectl to /etc/init.d

sudo cp /opt/httpd-2.4.2-server/bin/apachectl /etc/init.d/

  1. Set the default service at startup
    sudo update-rc.d apachectl defaults

In this way, the Apache httpd service can be automatically started after booting

6、 Allow remote access

Apache accesses this machine (localhost) by default. In order to allow other machines to access it, you need to modify the conf/httpd.conf file

1 ) Modify the default network port

Listen 12.34.56.78:80

Listen 8088 // To avoid conflicts, modify to 8088

2 ) Modify the administrator email address

ServerAdmin [email protected]

ServerAdmin [email protected]

3 ) Modify the domain name to allow external access

ServerName www.example.com:80

ServerName 172.27.29.14:8088

Reference recommendation:

Linux build discuz forum

Install Apache under Ubuntu

configure: error: APR not found (recommended)

Compile Apache 2.4.2 in Solaris 10 in a x86(Stack OVerflow)

[ Tomcat and Apache integration configuration guide](http://wiki.ubuntu.org.cn/index.php?title=Tomcat%E4%B8%8EApache%E6%95%B4%E5%90%88%E9%85% 8D%E7%BD%AE%E6%8C%87%E5%8D%97&variant=zh-cn)

Recommended Posts

Ubuntu configure Apache
Ubuntu Apache configure https certificate
ubuntu 14.04 configure 3-wire 3IP
Ubuntu configure network commands
Ubuntu18.10 configure Java environment
Ubuntu 18.10 configure Nvidia driver
Ubuntu configure SecureCRT login
How to configure Apache content caching on Ubuntu 14.04
Configure tomcat on ubuntu server
ubuntu install and configure GitLab
Detailed steps to configure Ubuntu 16.04 and Apache virtual host
How to install Apache on Ubuntu 20.04
Install and configure MySQL on Ubuntu
Install and configure Docker in Ubuntu
ubuntu modify and configure ip address
Configure ring after installation on Ubuntu 16.04
Protect Apache with Let's Encrypt on Ubuntu 20.04
Configure Java development environment in Ubuntu20.04 LTS
Ubuntu software
How to configure Redis cluster on Ubuntu 14.04
Configure Nginx Git server on Ubuntu system
How to install Apache Maven on Ubuntu 20.04
Linux (ubuntu 12.04)
How to configure Redis replication on Ubuntu 16.04
Ubuntu16.04 configure your own network card information
Configure Nginx + PHP 7.0 + MySQL environment under Ubuntu 16.04
Configure node js and npm under Ubuntu 14.04
How to install and configure NATS on Ubuntu 16.04
Install JDK and configure environment variables on Ubuntu 16.04
How to install and configure Gogs on Ubuntu 18.04
How to configure TensorFlow use environment in Ubuntu
How to install and configure Cyberpanel on Ubuntu 18.04
How to install and configure ownCloud on Ubuntu 16.04
How to install and configure ownCloud on Ubuntu 16.04
How to install and configure Ansible on Ubuntu 18.04
How to install and configure Elasticsearch on Ubuntu 16.04
How to install and configure PostGIS on Ubuntu 14.04
How to install and configure Sphinx on Ubuntu 16.04
Configure automatic updates for Ubuntu Server on Azure
How to configure /var/log/messages in Ubuntu system log
How to install and configure AppScale on Ubuntu 12.04
How to install and configure PostGIS on Ubuntu 14.04