Install the Apache Web server on Ubuntu

Source: Internet
Author: User
Tags apc mcrypt fully qualified domain name

I studied ubuntu before and learned centos again due to the relationship between my colleagues in Guangzhou. Now I have learned little basics. Just now we have this resource, so we will study ubuntu. I found ubuntu is also quite good, relatively simple management and configuration. I would like to share it with you and record it, which may be useful in the future.


Environment description
Linux ubuntu 10.04.3 x64 + Apache2
 
1. Log on to your system and remember to use root
II. Install Apache

1. Enter the following command to install

# Apt-get install apache2
Under normal circumstances, the following prompt is displayed, (www.111cn.net) indicates that Apache2 has been installed by default:

Root @ paipat :~ # Apt-get install apache2
Reading package lists... Done
Building dependency tree... Done
Apache2 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

2. Enable pseudo static state of Apache2
If you want to enable Apache2 pseudo-static rewrite support, run the following command to install

# A2enmod rewrite
Under normal circumstances, the following prompt is displayed, indicating that the installation is successful:

Root @ paipat :~ # A2enmod rewrite
Module rewrite installed; run/etc/init. d/apache2 force-reload to enable.

 

Or the following prompt appears, indicating that rewrite has been enabled.

Root @ paipat :~ # A2enmod rewrite
Mudule rewrite already enabled


3. Install the php environment
Run the following command to install php5 extension of apache2 and mysql extension of php.

# Apt-get install libapache2-mod-php5 php5-gd php5-mysql php5-curl php5-mcrypt php5-common php-apc


Note:

Root @ paipat :~ # Apt-get install libapache2-mod-php5 php5-gd php5-mysql php5-mcrypt

Php5-common php-apc
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
Libgd2-xpm lib120062 libt1-5 libx11-6 libx11-data libxau6 libxcb1 libxdmcp6
Libxpm4 php5-cli php5-common php-apc
Suggested packages:
Php-pear libgd-tools php5-suhosin
The following NEW packages will be installed:
Libapache2-mod-php5 libgd2-xpm lib000062 libt1-5 libx11-6 libx11-data
Libxau6 libxcb1 libxdmcp6 libxpm4 php5-cli php5-common php5-gd php5-mysql php5-

Mcrypt
0 upgraded, 15 newly installed, 0 to remove and 26 not upgraded.
Need to get 8128kB of archives.
After this operation, 22.7 MB of additional disk space will be used.
Do you want to continue [Y/n]?
Enter Y and press enter to continue. The installation is complete.

Restart apache2 and enter the following command:

#/Etc/init. d/apache2 restart
The prompt is as follows, indicating that the startup is successful:

Root @ paipat :~ #/Etc/init. d/apache2 restart
* Restarting web server apache2

Apache2: cocould not reliably determine the server's fully qualified domain name,

Using 0.3.175.20.for ServerName
[OK]

Test site www.111cn.net
The preceding commands have completely installed the environment of a Web server. Below we will build a simple site.

The root directory of the web is located in/var/www. You can directly put your programs in this directory.

Create a new php test page # vi/var/www/test. php

Then press I to start editing and copy the following code.

<? Php
Phpinfo ();
?>

Press Esc to cancel editing, and then press: wq to save. Enter http: // 192.168.1.10/test. php to test.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.