Linux Gossip (20): Apache Service configuration

Source: Internet
Author: User
Tags readable

1.apache Introduction
?
? We often have to browse the Web to provide such services as Apache. The software that provides Apache services is the httpd service.
?
? Apache supports many features, most of which are implemented by compiled modules. These features are supported from the server-side programming language to the identity authentication scheme. Some common language interfaces support PERL,PYTHON,TCL, and PHP. The popular authentication modules include Mod_access,mod_auth and mod_digest. Other examples are SSL and TLS support (MOD_SSL), proxy server modules, useful URL rewriting (implemented by mod_rewrite), custom log files (mod_log_config), and filtering support (Mod_ Include and Mod_ext_filter). Apache logs can be analyzed using a free script awstats or visitors from a Web browser.
?
Apache service configuration is very particular, we first to provide services, including Perl, Python, PHP. Finally, the service is provided on the basis of the implementation of its security.
?

?
? is a basic architecture of our Apache server.
?
?2.Configure Apache Services

? 1) First we are going to install Apache service, the installation file is httpd:
?
?
?
Fortunately, our httpd is already installed. Start the httpd service and discover that our hostname needs to be modified:
?
?

Modify the/etc/hosts file to add a comparison between the native IP and the domain name:
?
?
?
?
?
After starting again, we found that the previous hints were missing:


?
The service has finally started, and our default publishing directory for Apache is:/var/www/html, the default publishing file is the one in the directory below.index.html.
?
? Let's simply write a index.html file (created under the default publishing directory):
?
?
?
?
?
? We can see that this file is readable for anyone:
?
?
?
? Then we will visit this server:
?
?
?
? hehe, but I can't see what's being published. Think we just saw that the permissions are readable, and the problem should be on the firewall. We shut it down without involving firewall learning:
?
?
?
?
?
? Then restart the HTTPD service to access the server again:
?
?
?
? Visit again:
?
?
?
You can see it this time.
?
?2. Set your own default publishing directory
??
? Sometimes we do not want to set the default publishing directory as:/var/www/html, if you want to set a different directory as the default publishing directory, we have to modify the httpd configuration file:
?
?
?
? We modified the default publishing directory for httpd to/www/html:
?
?
? 1) First we will create this directory and then create the default publish file index.html:
?
?
?

?
Restart the httpd service, and then view the default publication (our firewall is turned off at this point):
?
?
?
?
?
? You can see this interface, remember, once this problem occurs. That is, SELinux has insufficient authority, we must set the security context for the default publishing directory:
?
? First we are going to install a software that modifies the security context:
?
?
?
? Modify the security context of the/www/html:
?
?
?
? To view the security context of/www/html, it has indeed become accessible security contexts:
?
?
?
? Once again, we can see what the default release is:
?
?
?
? Above we have implemented the default publishing directory of the HTTPD service, and implemented the publishing of HTML content. However, there are not enough questions about permissions and security aspects. We can set the identity of the access user to avoid access by illegal users.
?
1) If we only allow access to this machine.
?
? 1. Modify the configuration file:
?
?
In this directory, we only allow access to the native IP.
?
After restarting the service, use a different host to see what the results are:
?
?
?
? Then the local access result:
?
?

2) If we only allow users of this segment to access.
?
? or to modify a configuration file:
?
?
?
After restarting the service, users of this network segment 192.168.0.0/24 can access the Apache.
?
Summary
?
This section explains the basic configuration of the Apache service, which we'll explain in a future post for encryption and access rules for both intranet and Internet.
?
?
?
?
?
?
?
?
?
?
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.