Linux operation and maintenance basics httpd static web page tutorial

Linux operation and maintenance basics httpd static web page tutorial

1. Use the warehouse to create the httpd lrzsz unzip file

1. Mount [root@clq0917 ~]# mount /dev/cdrom /mnt/
mount: /dev/sr0 is write-protected and will be mounted in read-only mode to write the configuration file [root@clq0917 ~]# vi /etc/yum.repos.d/aa.repo
[aa]
name=sssaaa
baseurl=file:///mnt
gpgcheck=0
enabled=1
 Press the ESC key and enter :x to save and clean up the warehouse [root@clq0917 ~]# yum clean all
 Metadata creation [root@clq0917 ~]# yum makecache
2.Install [root@clq0917 ~]# yum -y install httpd
[root@clq0917 ~]# yum -y install lrzsz 
[root@clq0917 ~]# yum -y install httpd
[root@clq0917 ~]# yum -y install unzip

2. Unzip the source code file

insert image description here

[root@clq0917 ~]# cd /var/www/html
Add file [root@clq0917 html]# rz
Unzip [root@clq0917 html]# unzip wangzhang.zip
mv (decoded data) + name (wangzhang)
[root@clq0917 html]# unzip zhishaizi.zip
mv (decoded data) + name (zhishaizi)
[root@clq0917 html]# unzip zhuawawa.zip
mv (decoded data) + name (zhuawawa)
Delete unused [root@clq0917 html]# rm -rf zhuawawa.zip
[root@clq0917 html]# rm -rf wangzhang.zip
[root@clq0917 html]# rm -rf zhishaizi.zip
Check:
[root@clq0917 html]# ls
wangzhang zhishaizi zhuawawa

3. 3 ways to configure httpd-vhosts.conf

1.[root@clq0917 html]# vi httpd-vhosts.conf 
Listen 98
<VirtualHost *:98>
    DocumentRoot "/var/www/html/wangzhang"
    ServerName wz.example.com
</VirtualHost>
Listen 99
<VirtualHost *:99>
    DocumentRoot "/var/www/html/zhuawawa"
    ServerName zww.example.com
</VirtualHost>
Listen 100
lHost *:100>
    DocumentRoot "/var/www/html/zhishaizi"
    ServerName zsz.example.com
</VirtualHost>
Refresh it:
[root@clq0917 html]# systemctl restart httpd
[root@qn conf.d]# ss -antl
State Recv-Q Send-Q Local Address:Port Peer Address:Port      
LISTEN 0 128 0.0.0.0:22 0.0.0.0:*         
LISTEN 0 128 *:98 *:*         
LISTEN 0 128 *:99 *:*         
LISTEN 0 128 *:100 *:*         
LISTEN 0 128 [::]:22 [::]:*

Seeing port numbers 98, 99, and 100 indicates success.

Method 1: (same IP, different port number configuration)

1.[root@clq0917 html]# vi httpd-vhosts.conf 
Listen 98
<VirtualHost *:98>
    DocumentRoot "/var/www/html/wangzhang"
    ServerName wz.example.com
</VirtualHost>
Listen 99
<VirtualHost *:99>
    DocumentRoot "/var/www/html/zhuawawa"
    ServerName zww.example.com
</VirtualHost>
Listen 100
lHost *:100>
    DocumentRoot "/var/www/html/zhishaizi"
    ServerName zsz.example.com
</VirtualHost>
Refresh it:
[root@clq0917 html]# systemctl restart httpd
[root@qn conf.d]# ss -antl
State Recv-Q Send-Q Local Address:Port Peer Address:Port      
LISTEN 0 128 0.0.0.0:22 0.0.0.0:*         
LISTEN 0 128 *:98 *:*         
LISTEN 0 128 *:99 *:*         
LISTEN 0 128 *:100 *:*         
LISTEN 0 128 [::]:22 [::]:*
Seeing port numbers 98, 99, and 100 indicates success.

Baidu search:

192.168.174.131:98
192.168.174.131:99
192.168.174.131:100

Effect picture:

insert image description here

insert image description here

insert image description here

Method 2: (different IP, same port number configuration)

1. Configure the IP address [root@clq0917 html]# ip addr add 192.168.174.175/24 dev ens33
[root@clq0917 html]# ip addr add 192.168.174.176/24 dev ens33
[root@clq0917 html]# vi httpd-vhosts.conf 
Listen 99
<VirtualHost 192.168.174.131:99>
    DocumentRoot "/var/www/html/wangzhang"
    ServerName wz.example.com
</VirtualHost>
<VirtualHost 192.168.174.175:99>
    DocumentRoot "/var/www/html/zhuawawa"
    ServerName zww.example.com
</VirtualHost>
lHost 192.168.174.176:99>
    DocumentRoot "/var/www/html/zhishaizi"
    ServerName zsz.example.com
</VirtualHost>
Refresh it:
[root@clq0917 html]# systemctl restart httpd
[root@qn conf.d]# ss -antl
State Recv-Q Send-Q Local Address:Port Peer Address:Port                   
LISTEN 0 128 *:99 *:*         
                          *:*         
LISTEN 0 128 [::]:22 [::]:*
Seeing port number 99 indicates success.

Baidu search:

192.168.174.131:99
192.168.174.175:99
192.168.174.176:99

Effect picture:

insert image description here

insert image description here

insert image description here

Method 3: (Same IP, same port number, different domain name)

1.[root@clq0917 html]# vi httpd-vhosts.conf 
Listen 80
<VirtualHost *:80>
    DocumentRoot "/var/www/html/wangzhang"
    ServerName wz.example.com
</VirtualHost>
<VirtualHost *:80>
    DocumentRoot "/var/www/html/zhuawawa"
    ServerName zww.example.com
</VirtualHost>
lHost *:80>
    DocumentRoot "/var/www/html/zhishaizi"
    ServerName zsz.example.com
</VirtualHost>
Refresh it:
[root@clq0917 html]# systemctl restart httpd
[root@qn conf.d]# ss -antl
State Recv-Q Send-Q Local Address:Port Peer Address:Port      
LISTEN 0 128 0.0.0.0:22 0.0.0.0:*         
LISTEN 0 128 *:80 *:*         
Seeing port number 80 indicates success.
Go to C:\Windows\System32\drivers\etc on drive C, drag the hosts file to the desktop and open it with WordPad, add the following content and save it: 192.168.174.131 wz.example.com zww.example.com zsz.example.com
Drag the hosts file on the desktop back to the C:\Windows\System32\drivers\etc directory, open CMD, enter ping zww.example.com to see if it works, then use the domain name to access it in the browser

hosts:

insert image description here

insert image description here

cmd:

insert image description here

insert image description here

The above is the detailed content of the Linux operation and maintenance basic httpd static web page tutorial. For more information about Linux operation and maintenance httpd static web pages, please pay attention to other related articles on 123WORDPRESS.COM! Thanks for reading~

You may also be interested in:
  • Linux operation and maintenance basic swap partition and lvm management tutorial
  • Linux Operation and Maintenance Basic System Disk Management Tutorial
  • Linux operation and maintenance basic process management real-time monitoring and control
  • Linux operation and maintenance basic process management and environment composition analysis

<<:  How to design high-quality web pages Experience in designing high-quality web pages (pictures and text)

>>:  Detailed explanation of MySQL multi-table join query

Recommend

Detailed Introduction to Nginx Installation and Configuration Rules

Table of contents 1. Installation and operation o...

Docker configures the storage location of local images and containers

Use the find command to find files larger than a ...

In-depth study of JavaScript array deduplication problem

Table of contents Preface 👀 Start researching 🐱‍🏍...

How to solve the problem of FileZilla_Server:425 Can't open data connection

When installing FileZilla Server on the server, t...

Ways to improve MongoDB performance

MongoDB is a high-performance database, but in th...

Solution to Element-ui upload file upload restriction

question Adding the type of uploaded file in acce...

MySQL transaction concepts and usage in-depth explanation

Table of contents The concept of affairs The stat...

Record the steps of using mqtt server to realize instant communication in vue

MQTT Protocol MQTT (Message Queuing Telemetry Tra...

Vue implements drag and drop or click to upload pictures

This article shares the specific code of Vue to a...

How to count down the date using bash

Need to know how many days there are before an im...

Introduction to the B-Tree Insertion Process

In the previous article https://www.jb51.net/arti...

Several CSS3 tag shorthands (recommended)

border-radius: CSS3 rounded corners Syntax: borde...

Detailed explanation of Linux Namespace User

User namespace is a new namespace added in Linux ...

Solve the problem of inconsistent MySQL storage time

After obtaining the system time using Java and st...