memcache:192.168.154.131
nginx:192.168.154.132
php:192.168.154.133
mysql:192.168.154.134
软件:
memcache上:libevent-2.0.22-stable.tar.gz、memcached-1.4.33.tar.gz
下载地址:
下载地址:
nginx上:nginx-1.14.0.tar.gz
下载地址:
php上:libmcrypt-2.5.7.tar.gz、php-5.6.27.tar.gz、memcache-3.0.8.tgz
下载地址:https://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/
下载地址:
mysql上:mysql-8.0.11-linux-glibc2.12-x86_64.tar.gz(二进制包)
下载地址:https://dev.mysql.com/downloads/mysql/
步骤
nginx部分
groupadd -r www
useradd -r -g www -s /sbin/nologin www
tar zxf nginx-1.14.0.tar.gz
cd nginx-1.14.0
./configure --prefix=/usr/local/nginx \
--with-http_dav_module --with-http_stub_status_module \
--with-http_addition_module --with-http_sub_module \
--with-http_flv_module --with-http_mp4_module \
--with-pcre=/root/pcre-8.39 --with-zlib=/root/zlib-1.2.8 \
--with-http_ssl_module --with-http_gzip_static_module --user=www --group=www
make && make install
ln -s /usr/local/nginx/sbin/nginx /usr/local/sbin
nginx
firewall-cmd --permanent --add-port=80/tcp
firewall-cmd --reload
nginx配置文件/usr/local/nginx/conf/nginx.conf
user www www;
worker_processes 4;
worker_cpu_affinity 0001 0010 0100 1000;
error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;pid logs/nginx.pid;
events {
use epoll;
worker_connections 65535;
multi_accept on;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
tcp_nopush on;
keepalive_timeout 65;
tcp_nodelay on;
client_header_buffer_size 4k;
open_file_cache max=102400 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 1;
client_header_timeout 15;
client_body_timeout 15;
reset_timedout_connection on;
send_timeout 15;
server_tokens off;
client_max_body_size 10m;
fastcgi_connect_timeout 600;
fastcgi_send_timeout 600;
fastcgi_read_timeout 600;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 128k;
fastcgi_temp_path /usr/local/nginx/nginx_tmp;
fastcgi_intercept_errors on;
fastcgi_cache_path /usr/local/nginx/fastcgi_cache levels=1:2 keys_zone=cache_fastcgi:128m inactive=1d max_size=10g;
gzip on;
gzip_min_length 2k;
gzip_buffers 4 32k;
gzip_http_version 1.1;
gzip_comp_level 6;
gzip_types text/plain text/css text/javascript application/json application/javascript application/x-javascript application/xml;
gzip_vary on;
gzip_proxied any;
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location ~* ^.+\.(jpg|gif|png|swf|flv|wma|wmv|asf|mp3|mmf|zip|rar)$ {
valid_referers none blocked 192.168.154.132;
if ($invalid_referer) {
return 404;
break;
}
access_log off;
}
location / {
root html;
index index.php index.html index.htm;
}
location ~* \.(ico|jpe?g|gif|png|bmp|swf|flv)$ {
expires 30d;
#log_not_found off;
access_log off;
}
location ~* \.(js|css)$ {
expires 7d;
log_not_found off;
access_log off;
}
location = /(favicon.ico|roboots.txt) {
access_log off;
log_not_found off;
}
location /status {
stub_status on;
}
location ~ .*\.(php|php5)?$ {
root html;
fastcgi_pass 192.168.154.133:9000;
fastcgi_index index.php;
include fastcgi.conf;
#关闭fastcgi的缓存 fastcgi_cache cache_fastcgi;
fastcgi_cache_valid 200 302 1h;
fastcgi_cache_valid 301 1d;
fastcgi_cache_valid any 1m;
fastcgi_cache_min_uses 1;
fastcgi_cache_use_stale error timeout invalid_header http_500;
fastcgi_cache_key $host$request_uri;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
nginx -s reload
php部分
tar zxf libmcrypt-2.5.7.tar.gz
cd libmcrypt-2.5.7
./configure --prefix=/usr/local/libmcrypt && make && make install
yum -y install libxml2-devel libcurl-devel openssl-devel bzip2-devel
tar zxf php-5.6.27.tar.gz
cd php-5.6.27