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

A detailed tutorial on making httpd static Web pages with Linux

2025-02-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly explains the "Linux making httpd static web page detailed tutorial", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "Linux httpd static web page detailed tutorial" it!

Catalogue

1. Create httpd lrzsz unzip file by using warehouse

two。 Decompress the source file

3. Three ways to configure httpd-vhosts.conf

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

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

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

1. Use the warehouse to create httpd lrzsz unzip files 1. Mount [root@clq0917 ~] # mount / dev/cdrom / mnt/mount: / dev/sr0 write protection, mount the write configuration file [root@clq0917 ~] # vi / etc/yum.repos.d/aa.repo [aa] name=sssaaabaseurl= file:///mntgpgcheck=0enabled=1 as read-only, press the ESC key, and enter: X save and clean warehouse [root@clq0917 ~] # yum clean all metadata to establish [root@clq0917 ~] # yum makecache2. Install [root@clq0917] # yum-y install httpd [root@clq0917 ~] # yum-y install lrzsz [root@clq0917 ~] # yum-y install httpd [root@clq0917 ~] # yum-y install unzip2. Decompress the source file

[root@clq0917 ~] # cd / var/www/html plus file [root@clq0917 html] # rz decompress [root@clq0917 html] # unzip wangzhang.zipmv (decoded data) + name (wangzhang) [root@clq0917 html] # unzip zhishaizi.zipmv (decoded data) + name (zhishaizi) [root@clq0917 html] # unzip zhuawawa.zipmv (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 View: [root@clq0917 html] # lswangzhang zhishaizi zhuawawa3. Three ways to configure httpd-vhosts.conf 1. [root@clq0917 html] # vi httpd-vhosts.conf Listen 98 DocumentRoot "/ var/www/html/wangzhang" ServerName wz.example.comListen 99 DocumentRoot "/ var/www/html/zhuawawa" ServerName zww.example.comListen 100lHost *: 100 > DocumentRoot "/ var/www/html/zhishaizi" ServerName zsz.example.com refresh: [root@clq0917 html] # systemctl restart httpd [root@qn conf.d] # ss- AntlState 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 [:]: * the 98 99 and 100 port numbers indicate success. Method 1: (same IP Different port number configurations) 1. [root@clq0917 html] # vi httpd-vhosts.conf Listen 98 DocumentRoot "/ var/www/html/wangzhang" ServerName wz.example.comListen 99 DocumentRoot "/ var/www/html/zhuawawa" ServerName zww.example.comListen 100lHost *: 100 > DocumentRoot "/ var/www/html/zhishaizi" ServerName zsz.example.com refresh: [root@clq0917 html] # systemctl restart httpd [root@qn conf.d] # ss-antlState Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 0.0.0.0 22 0.0.0.015 * LISTEN 0 128 *: 98 * : * LISTEN 0 128 *: 99 *: * LISTEN 0 128 *: 100 *: * LISTEN 0 128 [:]: 22 [:]: * the 98 99 and 100 port numbers indicate success.

Baidu search:

192.168.174.131:98

192.168.174.131:99

192.168.174.131:100

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 ServerName wz.example.com DocumentRoot 24 dev ens33 [root@clq0917 html] # ip addr add 192.168.174.176 root@clq0917 html 24 dev ens33 [root@clq0917 html] # vi httpd-vhosts.conf Listen 99 DocumentRoot "/ var/www/html/wangzhang" ServerName wz.example.com DocumentRoot "/ var/www/html/zhuawawa" ServerName zww.example.comlHost 192.168.174.176 ServerName wz.example.com DocumentRoot > DocumentRoot "/ var/www/html / zhishaizi "ServerName zsz.example.com refresh: [root@clq0917 html] # systemctl restart httpd [root@qn conf.d] # ss-antlState Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0128 *: 99 *: * *: * LISTEN 0128 [::]: 22 [::]: * the 99 port number indicates success.

Baidu search:

192.168.174.131:99

192.168.174.175:99

192.168.174.176:99

Effect picture:

Method 3: (same IP, same port number ) 1. [root@clq0917 html] # vi httpd-vhosts.conf Listen 80 DocumentRoot "/ var/www/html/wangzhang" ServerName wz.example.com DocumentRoot "/ var/www/html/zhuawawa" ServerName zww.example.comlHost *: 80 > DocumentRoot "/ var/www/html/zhishaizi" ServerName zsz.example.com refresh: [root@clq0917 html] # systemctl restart httpd [root@qn conf.d] # ss-antlState 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 the 80 port number indicates success. Go to the C:\ Windows\ System32\ drivers\ etc directory on disk C, drag the hosts file onto the desktop and open it with WordPad, add the following and save 192.168.174.131 wz.example.com zww.example.com zsz.example.com, drag the hosts file on the desktop to C:\ Windows\ System32\ drivers\ etc directory, open CMD, type ping zww.example.com to see if it can be accessed, and then use the domain name to access it on the browser.

Hosts:

Cmd:

Thank you for your reading, the above is the content of "Linux making httpd static web page detailed tutorial". After the study of this article, I believe you have a deeper understanding of the problem of Linux making httpd static web page detailed tutorial, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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

*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

Development

Wechat

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

12
Report