Nginx+apache+mysql+php+memcached+squid Clustered Web Environment (1/6) _php Tutorial

Source: Internet
Author: User
Tags mysql tutorial php mysql php mysql tutorial
Client| ===> | Load Balancer | ===> | Reverse proxy/ Cache| ===> |web Server | ===> | Database TutorialsServer |
-------- ---------- ------------- --------- ------------
Nginx squid apache,php mysql Tutorial
Eaccelerator/memcache Preparatory work:
Referral server: Intel (R) Xeon (tm) CPU 3.00ghz * 2, 2GB mem, Scisc HDD
Operation system: centos4.4, kernel version 2.6.9-22.ELSMP,GCC version 3.4.4
Software:
Apache 2.2.3 (can use MPM mode)
PHP 5.2.0 (This version is selected because 5.2.0 's enginerelatively more efficient)
Eaccelerator 0.9.5 (accelerates PHP engine, also can encrypt PHP source program)
Memcache 1.2.0 (for Cache common Data)
Libevent 1.2a (required for memcache working mechanism)
MySQL 5.0.27 (choose binary version, save compilation work)
Nginx 0.5.4 (used as load balancer)
Squid-2.6.stable6 (provides professional caching while doing reverse proxy function)

second, compile and install
I.) Installation of Nginx
1.) Installation
The Nginx pronunciation is [engine x], which was established by the Russian Igor Sysoev Project, based on the BSD license. It is said that he was one of the members of F5, English homepage:/http Nginx. Net. Some of Russia's big Web sites have been using it for more than two years, and have been remarkable.
The compiler parameters of Nginx are as follows:

[Root@localhost]#./configure--prefix=/usr/local/server/nginx--with-openssl=/usr/include
--with-pcre=/usr/include/pcre/--with-http_stub_status_module--without-http_memcached_module
--without-http_fastcgi_module--without-http_rewrite_module--without-http_map_module
--without-http_geo_module--without-http_autoindex_module
Here, you need to explain, because Nginx configuration fileI want to use the regular, so I need pcre ModuleThe support. I have installed the RPM package for Pcre and Pcre-devel, but Ngxin does not find the. h/.so/.a/.la file correctly, so I am slightly flexible:

[Root@localhost] #mkdir/usr/include/pcre/.libs/
[Root@localhost] #cp/usr/lib/libpcre.a/usr/include/pcre/.libs/libpcre.a
[Root@localhost] #cp/usr/lib/libpcre.a/usr/include/pcre/.libs/libpcre.la
Then, modify the Objs/makefile about 908 lines, commenting out the following:

./configure--disable-shared
Next, you will be able to perform the make and makes install normally.

2.) Modify the configuration file/usr/local/server/nginx/conf/nginx.conf
The following is my nginx.conf content, for reference only:

#运行用户
User nobody nobody;
#启动进程
Worker_processes 2;
#全局错误 Logand PID File
Error_log Logs/error.log Notice;
PID Logs/nginx.pid;
#工作模式及连接数上限
Events {
Use Epoll;
Worker_connections 1024;
}
#设定http服务器, using its reverse proxy function to provide load balancing support
HTTP {
#设定mime类型
Include Conf/mime.types;
Default_type Application/octet-stream;
#设定日志格式
Log_format Main ' $remote _addr-$remote _user [$time _local] '
"$request" $status $bytes _sent '
' "$http _referer" "$http _user_agent" '
' $gzip _ratio ';
Log_format Download ' $remote _addr-$remote _user [$time _local] '
"$request" $status $bytes _sent '
' "$http _referer" "$http _user_agent" '
' "$http _range" "$sent _http_content_range";
#设定请求缓冲
Client_header_buffer_size 1k;
Large_client_header_buffers 4 4k;
#开启gzip模块
gzip on;
Gzip_min_length 1100;
Gzip_buffers 4 8k;
Gzip_types Text/plain;
Output_buffers 1 32k;
Postpone_output 1460;
#设定access Log
Access_log Logs/access.log Main;
Client_header_timeout 3m;
Client_body_timeout 3m;
Send_timeout 3m;
Sendfile on;
Tcp_nopush on;
Tcp_nodelay on;
Keepalive_timeout 65;
#设定负载均衡的服务器列表
UPS Tutorial Tream Mysvr {
#weigth参数表示权值, the higher the weight, the greater the chance of being assigned.
#本机上的squid开启3128端口
Server 192.168.8.1:3128 weight=5;
Server 192.168.8.2:80 weight=1;
Server 192.168.8.3:80 weight=6;
}1 2 3 4 5 6

http://www.bkjia.com/PHPjc/629849.html www.bkjia.com true http://www.bkjia.com/PHPjc/629849.html techarticle client, = = = | Load Balancer | = = = Reverse Proxy/Cache | = = = |web Server | = = = | Database Tutorial Server |-------------------------------------------------- --Nginx squ ...

  • 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.