1. Use the warehouse to create the httpd lrzsz unzip file1. 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[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.conf1.[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:
Effect picture: 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:
Effect picture: 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: cmd: 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:
|
>>: Detailed explanation of MySQL multi-table join query
Table of contents 1. Installation and operation o...
Use the find command to find files larger than a ...
Table of contents Preface 👀 Start researching 🐱🏍...
When installing FileZilla Server on the server, t...
MongoDB is a high-performance database, but in th...
question Adding the type of uploaded file in acce...
Table of contents The concept of affairs The stat...
MQTT Protocol MQTT (Message Queuing Telemetry Tra...
This article shares the specific code of Vue to a...
Need to know how many days there are before an im...
In the previous article https://www.jb51.net/arti...
border-radius: CSS3 rounded corners Syntax: borde...
1. Download from official website: https://dev.my...
User namespace is a new namespace added in Linux ...
After obtaining the system time using Java and st...