Ubuntu14.4 with Web server (Apache + PHP + mysql)

Source: Internet
Author: User
Tags file permissions fully qualified domain name

Today, take advantage of your own hands-on installation of Web server waste heat, the Ubuntu14.4 with the Web server process recorded.

"All Documents".

Description: Online tutorial on similar collocation Web server, there are countless cases, but own hands-on "Try", there will be a difference in the obtained.

1. User

Default is normal user.  that is, the default User: users. Of course, this user is the name of your login system. such as: Wuheng

Wuheng@wuheng-virtual-machine:~$

1-1, cut from user to root

Command:

Wuheng@wuheng-virtual-machine:~$ sudo su
Root@wuheng-virtual-machine:/home/wuheng#

Or:

Wuheng@wuheng-virtual-machine:~$ sudo su
[sudo] password for Wuheng:
Root@wuheng-virtual-machine:/home/wuheng#

At this point, we entered the root user.

1-2, cut from root user to user

There are 3 types of methods:

1-2-1:SU User (username is the default, such as Wuheng)

Root @wuheng-virtual-machine:/home/wuheng# su Wuheng
Wuheng@wuheng-virtual-machine:~$

1-2-2: Direct input: Exit

Root@wuheng-virtual-machine:/home/wuheng# exit
Exit
Wuheng@wuheng-virtual-machine:~$

1-2-3: Use key combination CTRL + D

Root@wuheng-virtual-machine:/home/wuheng# exit
Wuheng@wuheng-virtual-machine:~$

This usage is similar to Law 2.

Outreach: http://www.cnblogs.com/weiweiqiao99/archive/2010/11/10/1873761.html

Of course, the installation is done under the "root" user!

2. Installing Apache

Apache2 is a software package for Ubuntu, so we can install it directly with the following command:

Apt-get Install Apache2

Now, your browser to http://localhost, you should see the Apache2 test page, as follows:

Apache2 Ubuntu Default Page
It works!
。。。

3. Installing MYSQL5

Apt-get Install Mysql-server mysql-client

Note: During the installation process, there will be some prompts, need to set up MySQL account, password, etc., according to the prompt step by step to complete.

4. Installing PHP5

We can install the PHP5 and Apache PHP5 modules directly, as follows:

Apt-get Install PHP5 LIBAPACHE2-MOD-PHP5

5. Catalogue

Apache:

Configuration stored in subdirectories:/etc/apache2

Configuration file is:/etc/apache2/apache2.conf

Restart Apache command:/etc/init.d/apache2 restart

Php:

Configuration stored in subdirectories:/ETC/PHP5

Configuration file:/etc/php5/apache2/php.ini

File root directory:/var/www

MYSQ:

Configuration stored in subdirectories:/etc/mysql

Configuration file:/etc/mysql/my.cnf

Restart MySQL command:/etc/init.d/mysql reset

6. Test. info.php

6-1. Prepare the file.

<? PHP Echo Phpinfo ();? >

6-2, file permissions processing

chmod 777/var/www/-R

Note:/var/www, is the path to the file,-R (can be optionally added.) If it is added, it has the same file permissions as the file that is recursive to the subdirectory of the file, etc.)

6-3. Browser access

http://localhost/info.php

Such as:

PHP Version 5.5.9-1ubuntu4.14

。。。。。。。。。。

。。。。。。。。。。

The access was successful.

Note: The start of the Access report: 404 error.

Such as:

Httpd:could not reliably determine the server ' s fully qualified domain name

Httpd:could not reliably determine the server ' s fully qualified domain name, using 127.0.0.1 for ServerName

Workaround:

6-3-1, edit apache2.conf file

6-3-2, add the following:

#ServerRoot "/etc/apache2"
ServerName localhost:80

6-3-3, restart the server:/etc/init.d/apache2 restart




Ubuntu14.4 with Web server (Apache + PHP + mysql)

Related Article

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.