In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
Today, I will talk to you about the case analysis of the construction of RedHat Linux AS4 LAMP classic websites, many people may not know much about it. In order to make you understand better, the editor has summarized the following contents for you. I hope you can get something according to this article.
Apache is the number one Web server in the world. According to a survey conducted by Netcraf (www.netsraft.co.uk), more than 50% of the world's Web servers use Apache.
Especially now, it is a popular way to use LAMP (Linux + Apache + MySQL + PHP) to build medium-level applications, so mastering the configuration of Apache is one of the necessary skills for system engineers.
Using LAMP (Linux + Apache + MySQL + PHP) to build medium-level applications (especially e-commerce) has become a popular way, because it is all open source and free software, so the cost is very low. This section describes the construction of the platform. When building the platform, you can also install it directly using the RPM package, but since using the RPM package is not supported on some systems, we use a more general approach: install it directly from the source code.
Features of Apache:
1) it can run on almost all computer platforms.
2) support the latest HTTP/1.1 protocol
3) simple and powerful file-based configuration (HTTPD.CONF)
4) support Universal Gateway Interface (CGI)
5) support virtual host.
6) support HTTP authentication.
7) integrate PERL.
8) Integrated proxy server
9) you can monitor the status of the server through the WEB browser and customize the log.
10) support the server side to include commands (SSI).
11) support secure SOCKET layer (SSL).
12) it has the ability to track the process of user conversation.
13) support FASTCGI
14) support JAVA SERVLETS.
Install Apache from source code
Usually, for most e-commerce sites, there will be an online payment system. For security reasons, the payment system needs to be accessed using the https protocol, that is, it requires the support of SSL, so before you begin to install the apache software, install OpenSSL first.
The steps to install OpenSSL are as follows:
(1) obtain the source code:
Create a directory where the software is stored:
Mkdir / root/software (can be stored in any directory you want)
Download the source code package from http://www.openssl.org/source/ and put it in / root/software/.
In this case, openssl-0.9.8.tar.gz is downloaded.
(2) decompression software
Tar-zxvf openssl-0.9.8.tar.gz
(3) enter the source code directory:
Cd openssl-0.9.8
(4) configure compilation options:
. / config-prefix=/usr/local/openssl-shared
-- shared means to create shared library files, and if you don't add them, only static library files are generated at compile time.
(5) compile:
Make
Make test # Test
(6) installation
Make install
After execution, the relevant files will be copied to the corresponding directory of / usr/local/openssl.
If the system already has openssl installed at the time of installation, you can use rpm-qf openssl to find the rpm package installation directory in case you call it during apache installation
If you want to upgrade the openssl installed by the original rpm package, follow these steps:
A, rpm-e-nodeps openssl (forcibly delete the openssl of the rpm package, try not to do it by remote login)
B. backup / usr/include/openssl and delete two soft connections to libcrypto.so.0.9.7x and libssl.so.0.9.7x under / lib
C. Install openssl-0.9.8.tar.gz (step as above) install directory is / usr/local/openssl
D. Manually modify the soft connection of the lib library for ssh and other programs to call
Ln-s / usr/local/openssl/lib/libcrypto.so.0.9.8 / lib/libcrypto.so.4
Ln-s / usr/local/openssl/lib/libcrypto.so.0.9.8 / lib/libcrypto.so
Ln-s / usr/local/openssl/lib/libssl.so.0.9.8 / lib/libssl.so
Ln-s / usr/local/openssl/lib/libssl.so.0.9.8 / lib/libssl.so.4
E, echo / usr/local/openssl/lib > > / etc/ld.so.conf
F, ldconfig-v
G 、 / etc/init.d/sshd restart
H, Ssh-V check version information
After installing OpenSSL, you can install Apache. The steps to install Apache are as follows:
(1) obtain the source code
Create a directory where the software is stored:
Mkdir / root/software
Download the source code of the latest stable version from http://www.apache.org/ and put it in / root/software.
In this case, httpd-2.0.59.tar.bz2 is downloaded.
(2) decompress the package
Tar-jxvf httpd-2.0.59.tar.bz2
Cd httpd-2.0.59
(3) configure compilation options
Apache is a modular server, and the core server contains only the modules with the most commonly used functions, while the extended functions are provided by other modules. During the setup process, you must specify the modules to be included. There is a list of modules in the Apache documentation for reference, in which modules with a status of "Base" are included in the core server by default, must be explicitly disabled if they do not need to include a module (such as mod_userdir), and modules in other states (such as mod_expires) must also be explicitly enabled to be included in the core server.
Apache has two ways to use modules, one of which is to be permanently included in the core, and modules can also be compiled dynamically if the operating system supports dynamic shared objects (DSO) and can be detected by autoconf. The storage of the DSO module is independent of the core and can be included or excluded by the core using run-time configuration instructions provided by the mod_so module. If any dynamic modules are included in the compilation, the mod_so module is automatically included in the core. If you want the core to be able to load DSO without actually compiling any dynamic modules, you need to explicitly specify-- enable-so.
In our e-commerce site, in general, we enable all the core module functions; in addition, we also enable SSL encryption (mod_ssl); in order to make it easier for the search engine to include our web pages, we need to rewrite the URL of the dynamic page into the URL of the static page, and we need mod_rewrite; to dynamically add modules without recompiling apache (such as adding PHP support) in the future, and we need to enable mod_so. Based on the above analysis, when configuring compilation options, I recommend the following options:
. / configure-prefix=/usr/local/apache2-with-ssl=/usr/local/openssl
-enable-ssl-- enable-so-- enable-rewrite-- enable-mime-magic-- enable-mem-cache
The situation of each project and website is different, if you need to support other modules, please use the appropriate options at compile time. In your work or study, if you have any questions, please go to http://www.vfast.com/ to answer them in time.
(4) compile and install
Make
Make install
Install PHP from source code
PHP is a scripting language embedded in HTML and interpreted by the server. It can be used to manage dynamic content, support databases, handle session tracking, and even build entire e-commerce sites. It supports many popular databases, including MySQL, PostgreSQL, Oracle, Sybase, Informix, and Microsoft SQLServer.
In order to make PHP support related functions, you need to install the corresponding software before installation. For example, to make PHP support MySQL database, you must first install MySQL database before compiling PHP. For MySQL database installation, refer to Chapter 9 MySQL database installation.
After installing Apache and MySQL, you can start installing PHP. The steps to install PHP are as follows:
(1) obtain the source code
Create a directory where the software is stored:
Mkdir / root/software (can be stored in any directory you want)
Download the source code of the latest stable version from http://www.php.net/ and put it in / root/software.
In this case, php-5.1.4.tar.bz2 is downloaded.
(2) decompression
Tar-jxvf php-5.1.4.tar.bz2
Cd php-5.1.4
(3) configure compilation options
As mentioned just now, you intend to use MySQL to store data, so you must name the support for MySQL data (--with-mysql) and the location where the MySQL data is installed; if you need to deal with XML data, you need-- wiht-xml and-- with-dom;. If you need to use the PHP script to generate images, you need to use-- with-gd.
In short, if the library file of the feature you need to use is not in the system path, it must be explicitly supported, and if it is not explicitly supported, the configuration script will handle it automatically. What features the collective needs to use depends on the functions used by the site's PHP script. In most cases, you need to configure compilation options like this:
. / configure-- prefix=/usr/local/ php
-with-apxs2=/usr/local/apache2/bin/apxs-with-mysql=/usr/local/mysql
-with-mysql-sock=/usr/local/mysql/tmp/mysql.sock-with-xml-with-dom
-with-mcrypt-- with-iconv-- with-gd-- with-mime-magic
-with-openssl=/usr/local/openssl-enable-ftp
The-- with-apxs2=/usr/local/apache2/bin/apxs option is used to modify the configuration file of APACHE during installation, add the PHP module, and copy the module to the module directory of apache.
(4) compile and install
Make
Make install
(5) copy the configuration file of php
Cp php.ini-dist / usr/local/ php/ php/ php.ini
When compiling php, use-- with-config-file-path= [dir] to clearly indicate the storage location of the configuration file, then copy it to the specified location, otherwise copy it to: installation directory / usr/local/ php/
Test whether the installation is successful
To test, vi / usr/local/apache2/conf/httpd.conf:
(1) modify the value of DocumentRoot to specify the storage location of the web page
DocumentRoot "/ web"
(2) make sure that the file already exists and the following lines are enabled
LoadModule php5_module modules/lib php5.so
(3) add the following line to the file:
AddType application/x-httpd- php. Php
The goal is that files with the php extension will be parsed using the PHP program.
(4) create a test file / web/vfast. Php, which reads as follows:
(5) start apache service:
/ usr/local/apache2/bin/apachectl start
(6) visit the previous page in the browser, for example: http://localhost/vfast.php
If the information about php is returned successfully, the installation is successful.
After reading the above, do you have any further understanding of the case analysis of RedHat Linux AS4 LAMP classic website? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.