Leader yiwu.com-Technical insider based on J2EE resin (2)

Source: Internet
Author: User

Iv. Image Server Installation
Image servers are relatively easy and the most stable. I suggest using Lighttpd or nginx instead of Apache.
Lighttpd can support up to 50 to 80 m without cache. if the traffic is higher than the traffic, we recommend using Lighttpd + mod_mem_cache or
Lighttpd + memcached, but the latter is not configured successfully and cannot be started. Nginx and memcached are easier to integrate, but cannot automatically
Set to memcached, but also use PHP or Java programs to put images into memcached, not smart enough. I am using lighttpd1.4.20 + mod_mem_cache, yes

4 GB memory late, much better than Apache. Install the following mod_mem_cache patch for Lighttpd:
Tar-xzvf lighttpd-1.4.20.tar.gz
CP lighttpd-1.4.20.mod_mem_cache.patch lighttpd-1.4.20
Patch-P0 <lighttpd-1.4.20.mod_mem_cache.patch
Sh autogen. Sh
../Configure -- prefix =/usr/local/lighttpd-1.4.20
Make & make install

Add the following section to the configuration file:
Server. Modules = (
# "Mod_rewrite ",
# "Mod_redirect ",
# "Mod_alias ",
"Mod_access ",
# "Maid ",
# "Mod_trigger_b4_dl ",
# "Mod_auth ",
# "Mod_status ",
# "Mod_setenv ",
# "Mod_fastcgi ",
# "Mod_proxy ",
# "Mod_simple_vhost ",
# "Mod_evhost ",
# "Mod_userdir ",
# "Mod_cgi ",
# "Mod_compress ",
# "Mod_ssi ",
# "Mod_usertrack ",
"Mod_expire ",
# "Mod_secdownload ",
# "Mod_rrdtool ",
"Mod_accesslog ",
"Mod_mem_cache") # Add this

# Add the following configuration section
Mem-cache.filetypes = ("application/X-JavaScript", "text/CSS", "text/html", "text/JavaScript", "image/jpg ", "image/JPEG", "image/GIF", "image/PNG", "image/BMP ")

Mem-cache.enable = "enable"

#4096 m
Mem-cache.max-memory = 4096

#512 K
Mem-cache.max-file-size = 512

# LRU count
Mem-cache.lru-remove-count = 100000

#1 day
Mem-cache.expire-time = 1440

5. nginx can be used for load balancing. If load balancing is implemented based on IP addresses, you don't need to worry about distributed sessions. Here we will not talk about it. Just check it when necessary.

6. I have configured how Lighttpd + squid + Apache can accelerate the website. The first layer of Lighttpd must pass through squid, even if squid is cached, it will be slow, and there is no Lighttpd directly.

The following is a configuration file successfully configured for squid3.0, which can be cached. If no cache is available, it can be forwarded to port 81.
# Visible_hostname www.abc.com
Visible_hostname localhost
Http_port 3128 vhost vport
Cache_mem 2048 MB
Maximum_object_size_in_memory 2048 KB
Memory_replacement_policy LRU
# Cache_dir ufs/tmp 512 16 256
Cache_dir ufs/usr/local/squid/var/cache 2048 16 256
Max_open_disk_fds 0
Minimum_object_size 0 KB
Maximum_object_size 32768 KB
Logformat combined %> A % UI % UN [% TL] "% RM % Ru HTTP/% RV" % hs % <ST "% {Referer}> H" "% {user -Agent}> H "% SS: % sh

Access_log/usr/local/squid/var/logs/access_log combined
Cache_log/usr/local/squid/var/logs/cache. Log
Pid_filename/usr/local/squid/var/logs/squid. PID
# Cache_store_log none
Cache_peer 127.0.0.1 parent 81 0 no-query no-digest originserver name = WWW
# Cache_peer_domain WWW www.abc.com
Cache_peer_domain localhost
Cache_peer_access WWW allow all
Http_access allow all
ACL query urlpath_regex. exe
Cache deny Query
Cache_inclutive_user nobody
Cache_inclutive_group nobody

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.