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

The Optimization of Apache Web Page

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article introduces the relevant knowledge of "Apache web page optimization method". In the actual case operation process, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations! I hope you can read carefully and learn something!

I.Apache Web page compression:

Function: Configure Apache's web page compression function, which uses Gzip compression algorithm to compress the web page content published by Apache server and then transmit it to client browser. Usually when the CPU is idle and the bandwidth of the website is high, compression will be enabled;

Advantages:

1) Speed up web page loading and improve user browsing experience

2) Reduce network transmission bandwidth and save traffic on servers

3) Web page compression is conducive to search engine crawling

Apache modules that can implement web page compression include mod_gzip module and mod_deflate module.

Configuration AddOutputFilterByType DEFLATE text/html text/plain text/css text/xml text/javascript For what format is compression enabled DeflateCompression Level 9 Compression level is 9, range is 1-9, number is large compression ratio is high SetOutputFilter DEFLATE Enable deflate compression mode II Operation example 1. Check if mod_deflate module [root@www ~]# /usr/local/httpd/bin/apachectl -D DUMP_MODULES is installed| grep deflate deflate_module (static)Syntax OK2. Configuration module enabled mod_deflate module enabled

After compilation and installation, mod_defale module needs httpd.conf file enabled to take effect

[root@www ~]# vi /usr/local/httpd/conf/httpd.conf ##Add the following configuration at the end AddOutputFilterByType DEFLATE text/html text/plain text/css text/xml text/javascriptDeflateCompression Level 9SetOutputFilter DEFLATE:wq

3. packet capture verification

triple play cache

Apache page cache time:

Function: Apache is configured through mod_expires module, so that web pages can be cached in client browser for a period of time to avoid repeated requests and reduce the pressure on server side. After mod_expires module is enabled, Expires tag and CacheControl tag in page header information will be automatically generated, thus reducing the frequency and number of client visits, reducing unnecessary traffic and increasing access speed.

Note: The following configuration item must be used when compiling and installing--enable-expires ##Enable the page cache expiration time module

Configuration items:

ExpiresActive On ##Enable page caching time

ExpiresDefault "access plus 60 seconds" ##Set default cache for 1 minute

[root@www ~]# /usr/local/httpd/bin/apachectl -D DUMP_MODULES |grep expires expires_module (static)Syntax OK[root@www ~]# vi /usr/local/httpd/conf/httpd.conf ##Add the following configuration at the end ExpiresActive On ExpiresDefault "access plus 60 seconds" Clear browser history, revisit test: apache optimization Hide version number;

Modify the httpd.conf configuration file so that the httpd-default.conf file takes effect, which contains the contents of the version information returned

1. Change the master profile httpd. conf Remove the comment #Include conf/extra/httpd-default.conf2. Modify httpd-default. conf file two places 3. Server Tokens Full modified to Server Tokens PROV4. ServersSignature On modified to ServersSignature Off5. Restart httpd service, visit the website, grab the package test "Apache web page optimization method" content introduced here, thank you for reading. If you want to know more about industry-related knowledge, you can pay attention to the website. Xiaobian will output more high-quality practical articles for everyone!

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

Servers

Wechat

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

12
Report