Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Centos6.5 installation and configuration of LAMP Apache (1)

2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

one。 Install apache

There are two ways to install 1.apache, one is source code installation, the other is RPM installation, the latter is simpler than the former, but the function has some limitations, so here we adopt source code installation. The source package can be found here. "http://mirror.bit.edu.cn/apache/httpd/" can be uploaded to the server using xshell or putty."

two。 Decompression

Decompress to / usr/src

3. Configuration

Change to the unzipped directory

Ls View

-- prefix: specify the installation directory

-- enable-so: enable dynamic module loading support

-- enable-rewrite: enable address rewriting

-- enable-charset-lite: enable character set support

-- enable-cgi: enable cgi scripting support

& & stands for "and" can split multiple commands on the same line and execute them in turn

Make: compile make install: install

If the configuration fails, the possible reason:

(1. When installing the system, there are no development tools installed, yum-y install gcc (network connection is required)

You can install it directly with the yum source that comes with centos, or you can configure the local yum source:

① mount centos6.5 CD ② configuration yum file

(2. Source code packet does not match the number of bits of the system

4. Check to see if the installation is successful

Ls / usr/local/httpd was successfully installed to the directory

The main subdirectory functions:

Bin: stores executive program files, including main program httpd, service control tool apachectl, etc.

Conf: stores httpd configuration files, including main configuration files, enhanced configuration subdirectory extra, etc.

Htdocs: stores web documents, including default web pages, index.html, etc.

Logs: store log files

Modules: store httpd module files

Cgi-bin: store all kinds of cgi program files

5. Optimize the execution path (create soft links)

Function: you can directly run the command under / usr/local/httpd/bin/, such as httpd-v (check the httpd version)

6. Add as a system service and boot automatically

Copy the apache script under / etc/init.d/ and add the option chkconfig: run automatically at level 3 and 5, with a start order and shutdown order of 80 and 70

Add to serve the system and view

7. Configure httpd, start

Go to the main configuration file and change the ServerName option to ServerName www.51cto.com:80

You can use httpd-t to check whether the httpd.conf is correct

To start the httpd (another name for apache) service, you can use netstat-anpt | grep httpd to check whether port 80 is enabled.

8. Configure firewall rules

Clear firewall rules

Set default rules, inbound discard, forward discard, outbound allow.

Can be viewed with iptables-nL

Only web service (port 80) is open and local TCP reply packets are released, and others are discarded.

9. test

Client connection www.51cto.com (domain name assigned by dns)

It works is the default web page of apache. The visit is successful.

You can view server access logs and view logs

10.httpd.conf detailed explanation

Divided into two parts: global configuration options, zone configuration items

Global configuration options:

ServerRoot sets the server root directory Listen: sets the server listening port number. Default is 80.

User,Group: user identity and group identity when running the httpd service. Default is daemon.

ServerAdmin: sets the full hostname of the administrator E-mail ServerName:web site

DocumentRoot: Web page storage path DirectoryIndex: home page of the website

ErrorLog: error log file path LogLevel: log level

CustomLog: set access log file path PidFile: save the file of httpd process number

CharsetDefault: the default character set encoding Include used by web pages in the site: contains the contents of another configuration file, you can achieve some special functional configuration into a separate file. You can check out the apache help manual, which is not listed here.

Zone configuration item:

The next article will configure access control and virtual hosts and shared storage for apache.

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: 247

*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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report