Construct a LAMP framework using apache

Source: Internet
Author: User
Article Title: Construct an apache LAMP framework. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

LAMP framework is an important mode for software development. L in LAMP represents the open-source operating system Linux, A represents the most famous WWW server, and is also the Apache of open-source software, M stands for Mysql, an open-source database software with superior performance, and P stands for PHP, an open-source network scripting language, and Perl and Python. The latter two are also famous open-source software. LAMP is free software, but its performance is not inferior to commercial software. For example, Apache is better than Microsoft's IIS, which is a well-known fact. It is very popular in the information field, at the same time, many specific application systems are also built on the LAMP framework.

1. Apache installation and configuration is a WWW server software widely used in UNIX systems. According to Netcraft's statistics (http://news.netcraft.com/archives/web_server_survey.html), more than 60% of servers on the Internet are currently using Apache to provide web browsing services. Apache can be said to be the most popular Web server software in the world. It can not only run in FreeBSD, UNIX, and Linux, but also be installed in Windows.

Like FreeBSD, Apache also has multiple branches in the software version. Currently, the stable versions include 1.3 and 2.0.Apache1.3, which have been developed for a long time and are very stable and will not be changed significantly. The Apache2 series is an active development version. Its biggest difference from the 1.3 series is its support for multithreaded. Currently, Apache2.0.58 is the most stable version, while 2.2.2 is still under development.

Installing Apache On Debian is much easier than installing similar software on Windows systems. I only use one line of command to handle this: # apt-get install apache2

There are two Apache versions in Etch: Apache1 and apache2. The former is a tested and stable version, and there are still many practical applications. The latter has many new functions, we have installed the latter and the installed version is apache2.0.55.

The following are some common problems in actual use: 1) location of the configuration file: In Etch, the location of the configuration file in/etc/apache2/apache2.conf may be different from the name in other versions, the location is also different from that of apache1.

There are two directories under/etc/apache2/, which are mod-available and mod-enabled. Obviously, the former is the provided module, the latter is a module that can work normally. If you want to enable the provided modules, you need to establish a symbolic connection of the former in the directory of the latter.

2) The default home directory:/var/www/after the system is installed, I wrote a simple index.html file in the/var/wwwdirectory, with only one sentence: # cat index.html This is a Debian server and then check whether the output is correct on the client.

3) the location of the log file plays a major role. Apache has two log files, one of which is all records logged on to the apache server, /var/log/httpd-access. log, the file records the login ip, time, browser type, etc.; the other is the online error record file,/var/log/httpd-error.log, this file is very useful for debugging apache parameters. Both files are text files and can be viewed and edited by nano and other text editors. The file location and file name are changed by the corresponding configuration in httpd. conf.

3) start, stop, and restart the httpd server: apapche2ctl start (stop restart)

This command is useful, especially after the configuration file is modified.

4) issues with the personal user directory: Unlike apache1, it is important to modify the UserDir in the configuration file. apache2 uses the personal user as a module. First: cd/etc/apache2/mods_enabled ln-s/etc/apache2/mods_available/userdir. conf userdir. conf ln-s/etc/apache2/mods_available/userdir. load userdir. load apache2ctl restart, modify the main configuration file at the same time, comment out the # UserDir public_html sentence, and create an index.html file under the main directory/home/testof user test to view: http: // yourip /~ Test.

5) automatically support Chinese problems web page default character set parameters AddDefaultCharset ISO-8859-1 at this time in the browser browsing Chinese web page, will be garbled, you need to manually set the encoding method to GBK or GB2312 to display Chinese characters, remove the comment, and change it to adddefacharcharset GB2312.

6) after installing Apache, we need to keep abreast of all aspects of the server system. Apache2 has built-in server-status and server-info methods for viewing server information. Server-status refers to the server status information. We can understand the current running status of Apache, including the Occupied system resources and the current online quantity. Server-info displays the Apache version and loaded module information.

To use these two functions, we must first Modify/etc/apache2/apache2.conf. First, manually add a line of ExtendedStatus On. Otherwise, the information is not detailed enough.

Find and separate the two sections, remove the comments in the two sections, and set the access permission. If you do not pay attention to security, you can set allow from all. Then: cd/etc/apache2/mods_enabled ln-s/etc/apache2/mods_available/info. load info. load

Then you can use http: // hostname/server-info in the browser.

6) Other configuration parameters that I think are important: ServerRoot: Specifies the root directory for the server to save its configuration, errors, and log files.

Listen: allows you to bind Apache service to the specified IP address and port to replace the default DocumentRoot: root directory of your document. By default, all requests are responded from this directory.

HostnameLookups: Specifies whether to record the client name or IP address original link: http://www.osschool.org/wen/bbs/topic.php? Forumid = 1 & filename = f_243

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.