nginx+apache+mysql+php+memcached+squid cluster web environment (1/6)_PHP tutorial

WBOY
Release: 2016-07-13 17:08:21
Original
722 people have browsed it

Client | ===> |Load balancer| ===> |Reverse proxy/Cache| ===> |web Server| ===> |Database TutorialServer|
-------- ---------- ------------- ---------- ---------- --
nginx squid apache,php mysql tutorial
eaccelerator/memcache preparation:
Reference server: intel(r) xeon(tm) cpu 3.00ghz * 2, 2gb mem, scisc hard drive
Operating 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 was chosen because the 5.2.0
engine is relatively more efficient) eaccelerator 0.9.5 (accelerates the php engine and can also encrypt the php source
program ) memcache 1.2.0 (for caching commonly used
data) libevent 1.2a (required for memcache working mechanism)
mysql 5.0.27 (use the binary version to save compilation work)
nginx 0.5.4 (used as a load balancer)
squid-2.6.stable6 (does reverse proxy while providing professional caching
function )

2. Compile and install 1.) Install nginx
1.) Install
nginx is pronounced [engine x] and is a
project established by the Russian igor sysoev, based on the BSD license. It is said that he was one of the members of f5. English homepage: http://nginx.net. Some of the largest websites in Russia have been using it for more than two years and it has been performing well. The compilation 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, it needs to be explained that since I want to use regular expressions in the nginx configuration
file , I need the support of the pcre module . I have installed the rpm packages of pcre and pcre-devel, but ngxin cannot correctly find the .h/.so/.a/.la file, so I made a slight modification:
[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 objs/makefile at approximately line 908 and comment out the following:

./configure --disable-shared
Next, you can execute make and make install normally.

2.) Modify the configuration file /usr/local/server/nginx/conf/nginx.conf
Here are the contents of my nginx.conf for reference only:

#Run user
user nobody nobody;
#Start process
worker_processes 2;
#Global error
log and pid file error_log logs/error.log notice;
pid logs/nginx.pid;
#Working mode and maximum number of connections
events {
use epoll;
worker_connections 1024;
}
#Set up the http server and use its reverse proxy function to provide load balancing support
http {
#Set mime type
include conf/mime.types;
default_type application/octet-stream;
#Set log format
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"';
#Set request buffer
client_header_buffer_size 1k;
large_client_header_buffers 4 4k;
#Enable gzip module
gzip on;
gzip_min_length 1100;
gzip_buffers 4 8k;
gzip_types text/plain;
output_buffers 1 32k;
postpone_output 1460;
#Set 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;
#Set load balancing server list
ups tutorial stream mysvr {
The #weigth parameter represents the weight. The higher the weight, the greater the chance of being assigned
#Squid on this machine opens port 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

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/629849.htmlTechArticleClient| === |Load Balancer| === |Reverse Proxy/Cache| === |web server| === | Database tutorial server| -------- ---------- ------------- ------- -------------- nginx squ...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!