Linux Operational ENGINEER1.2 (HTTP service Basics, Web content access, secure Web)

Source: Internet
Author: User

ENGINEER1.2

HTTP Service Basics

Web services based on B/S architecture

Provide pages----the service side;

----browser to download and display the page;

--------------------------------------------------------------------------------------------------------------- -------------------------------

Rapid deployment of standalone WAB host

    1. Installing httpd

#yum-y Install httpd

2 Start the HTTPD service and set the boot

#systemctl Restart httpd

#systemctl Enable httpd

3. Write a webpage:

#echo MY First WEB >/var/www/htm/index.html

On desktop:

#elinks-dump 172.25.0.11

------Servername: DNS name registered on this site

    1. vim/etc/httpd/conf/httpd.conf //Modify host configuration file

      Vim Finder/ServerName

ServerName server0.example.com:80

2. Restart the HTTPD service:

#systemctl Restart httpd

On desktop:

#elinks-dump server0.example.com

To visit a Web site:

----documentroot: Web root directory (/var/www/html)

Service side:/var/www/html/

    1. To modify the contents of a master file #vim/etc/httpd/conf/httpd.conf

DocumentRoot "/VAR/WWW/ABC"

2. Create a directory #mkdir/VAR/WWW/ABC

3. Restart httpd service #systemctl restart httpd

4. Writing Web page files

#echo wo shi abc >/var/www/abc/index.html

On desktop

#elinks-dump server0.example.com

Virtual Web Host

Purpose: Save money

Multiple different Web sites are provided by the same server.

How to differentiate:

    1. Domain-based virtual machines

    2. Port-based virtual machines

    3. IP address-based virtual machines

Help Document:/usr/share/doc/httpd-2.4.6/httpd-vhosts.conf

    1. Establish a profile from a configuration file

#vim/etc/httpd/conf.d/nsd01.conf

<virtualhost *: 80>

Documentroot/var/www/test

ServerName www0.example.com

</VirtualHost>

<virtualhost *: 80>

Documentroot/var/www/nsd

ServerName webapp0.example.com

</VirtualHost>

2. Create the catalogue and the corresponding Web content

#echo wo shi Test >/var/www/test/index.html

#echo wo shi nsd >/var/www/nsd/index.html

3. Restart HTTPD Service

#systemctl Restart httpd

Virtual Web, all sites must use virtual addresses

--------------------------------------------------------------------------------------------------------------- ------------

Web Access Control

To configure directory permissions:

Folder permissions:

Permission control for the DocumentRoot Web directory:

---httpd running identity: Apche

What network resources can---extract

#vim/etc/httpd/conf/httpd.conf

User Apche

Group Apache

Client Address Restrictions:

Use <Directory> Configure sections

---Each file home automatically inherits ACL access from its parent directory

---unless explicitly set for subdirectories

Prohibit any client access

<dirctory/>

Require all denied

</Dirctory>

Allow any client access

<dirctory "/var/www/html" >

Require all granted

</Dirctory>

Only partial client access allowed

<Dirctory/var/www/html/private>

Require IP 127.0.0.1

</Dirctory>

--------------------------------------------------------------------------------------------------------------- -----------------------

SELinux Policy Protection

Security context (with the same label)

#chcon-R--reference=/var/www/webroot

--------------------------------------------------------------------------------------------------------------- ------------------------

Using custom Web Access

    1. Modifying a configuration file

#vim/etc/httpd/conf.d/nsd01.conf

<virtualhost *:80>

Document/webroot

ServerName server0.example.com

</VirtualHost>

2. Create a directory and a Web page file

#mkdir/webroot

#echo wo shi Webroot >/webroot/index.html

3. Modify the Access control configuration file

#vim/etc/httpd/conf.d/nsd02.conf

<directory "/webroot" >

Require all granted

</Directory>

4. Modify the SELinux label value:

#chcon-R--reference=/var/www/webroot

5. Restart the HTTPD service:

#systemctl Restart httpd

6. On the desktop:

#elinks-dumps server0.example.com




This article is from the Linux OPS blog, so be sure to keep this source http://13401400.blog.51cto.com/13391400/1978949

Linux Operational ENGINEER1.2 (HTTP service Basics, Web content access, secure Web)

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.