当前位置:网站首页>Installation of PHP FPM software +openresty cache construction
Installation of PHP FPM software +openresty cache construction
2022-07-03 08:20:00 【Baldness_ Technology blog for】
Tips : When the article is finished , Directories can be generated automatically , How to generate it, please refer to the help document on the right
List of articles
Preface
Tips : Here you can add the general content to be recorded in this article :
Tips : The following is the main body of this article , The following cases can be used for reference
One 、php-fpm The download
Two 、 Decompress and compile
1. decompression
yum install bzip2 # Minimize the need to install the system
tar -jxf php-7.4.12.tar.bz2
2. Install and resolve dependencies
cd php-7.4.6
./configure --prefix=/usr/local/lnmp/php --with-config-file-path=/usr/local/lnmp/php/etc --enable-fpm --with-fpm-user=nginx --with-fpm-group=nginx --with-curl --with-iconv --with-mhash --with-zlib --with-openssl --enable-mysqlnd --with-mysqli --with-pdo-mysql --disable-debug --enable-sockets --enable-soap --enable-inline-optimization --enable-xml --enable-ftp --enable-gd --enable-exif --enable-mbstring --enable-bcmath --with-fpm-systemd
The following are the required library files
yum install gcc openssl-devel systemd-devel oniguruma-devel libxml2-devel sqlite3-devel libsqlite3x-devel libcurl-devel libpng-devel -y

3.make && make install
make ; make install
3.php-fpm To enable
Copy the configuration file from the source directory to the directory for copying
cp php.ini-production /usr/local/lnmp/php/etc/php.ini # The configuration file
cp sapi/fpm/php-fpm.service /usr/lib/systemd/system/ # Start script location
cp sapi/fpm/php-fpm.conf /usr/local/lnmp/php/etc/
cp sapi/fpm/www.conf /usr/local/lnmp/php/etc/php-fpm.d/
vim /usr/lib/systemd/system/php-fpm.service
ProtectSystem=false # The default is full
systemctl daemon-reload
systemctl start php-fpm.service
3、 ... and 、php-fpm and nginx The combination of
vim ~/.bash_profile # take php Define into environment variables
PATH=$PATH:$HOME/bin:/usr/local/php/bin/ # Use : Split different environment variables
source ~/.bash_profile # Make variables effective
vim /usr/local/nginx/conf/nginx.conf # change nginx Configuration file for
The contents are as follows
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
#fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi.conf; # Change to fasecgi.conf You can view it nginx/conf/ Have fastcgi.conf
}
Four 、php-fpm+nginx+memcache Efficient caching strategy
1. Compilation and installation memcache
tar zxf memcache-4.0.5.2.tgz
phpize # The binary installation script can be generated under the source code path
yum install autoconf -y # The prompt will download and report an error
./configure --enable-memcache #--enable-memcache Open for indication memcache modular
make && make install
2. Turn on use
add to memcache Module to php-fpm
vim php.ini
extension=memcache # Leave no blank space, otherwise an error will be reported
yum install memcached -y # If there is no download, you can see that the module has been loaded but will not take effect
systemctl reload php-fpm # It will take effect after loading
systemctl start memcached # Turn on memcached
netstat -antlpue # Check to see if there is 11211 Port open
Copy the default publishing directory to /usr/local/nginx/html/, Change the password user and the location of the cache
vim /usr/local/nginx/html/memcache.php
define('ADMIN_USERNAME','nginx'); // Admin Username
define('ADMIN_PASSWORD','westos'); // Admin Password
$MEMCACHE_SERVERS[] = '172.25.0.91:11211'; // add more as an array

Conduct ab Pressure test

5、 ... and 、 structure openresty Cache
openresty: adopt Lua Expand Nginx Scalable implementation Web platform
1. Installation mode
Source package installation method
tar -zxf openresty-1.19.9.1.tar.gz
./configure
make && make install
repo File installation
wget -O /etc/yum.repos.d/openresty.repo https://openresty.org/package/rhel/openresty.repo # download repo After downloading the file, this connection is rhel Systematic repo file
yum install openresty -y
2. Construction of cache
vim /usr/local/openresty/nginx/conf/nginx.conf
upstream memcache {
server 127.0.0.1:11211; # You can directly access your own memcache
keepalive 512; # keep 512 Connections not closed immediately for performance
}
location /memc {
# This part defines a self memcache Cache keeps all data in memory for data storage
internal; # Indicates internal access only
memc_connect_timeout 100ms; # Indicates that the request timeout for access is 100 second
memc_send_timeout 100ms;
memc_read_timeout 100ms;
set $memc_key $query_string; # Use the built-in $query_string As a key
set $memc_exptime 300; # Indicates cache expiration time
memc_pass memcache;
}
location ~ \.php$ {
set $key $uri$args;
srcache_fetch GET /memc $key; # lookup /memc If there key If there is, enter location
srcache_store PUT /memc $key; #
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
#fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi.conf;
}
summary
边栏推荐
猜你喜欢

Multi traveling salesman problem -- overview of formula and solution process

IP production stream is so close to me

Open the influence list of "National Meteorological Short Videos (Kwai, Tiktok) in November" in an interactive way“

【云原生】微服务之Feign的介绍与使用

Puhua PLM empowers the whole scene product lifecycle management and helps the enterprise digital transformation of the main line of products

matlab神经网络所有传递函数(激活函数)公式详解

jupyter远程服务器配置以及服务器开机自启

Un système de gestion de centre commercial pour la conception de cours de technologie d'application de base de données

Detailed explanation of all transfer function (activation function) formulas of MATLAB neural network

CLion-Toolchains are not configured Configure Disable profile问题解决
随机推荐
[usaco12mar]cows in a skyscraper g (state compression DP)
Three characteristics
Multi traveling salesman problem -- overview of formula and solution process
C#课程设计之学生教务管理系统
What is BFC?
P2704 [noi2001] artillery position (shape pressure DP)
Unity performance optimization
Mysql容器化(1)Docker安装MySQL
Kwai 20200412 recruitment
Unity one click AssetBundle
A tunnel to all ports of the server
Mutual call between Lua and C #
Xlua task list youyou
Unity4.3.1 engine source code compilation process
Lua framwrok framework starts
Redis的数据结构
Osgearth north arrow display
Storage of data
MAE
oracle中的 (+)是什么意思