当前位置:网站首页>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
边栏推荐
- Easy touch plug-in
- Mall management system of database application technology course design
- P2704 [noi2001] artillery position (shape pressure DP)
- YOLO系列 --- xml2txt脚本
- [global product discovery 2] the first pure cloud augmented reality (AR) platform - Israel
- 方正锐利重磅升级到12.0版本,包装印前处理更加便捷、高效!
- Exe file running window embedding QT window
- Unity change default editor
- C语言-入门-精华版-带你走进编程(一)
- Basic operation and process control 2
猜你喜欢

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

Unity4.3.1 engine source code compilation process

方正锐利重磅升级到12.0版本,包装印前处理更加便捷、高效!

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

L'installateur a été installé avec une erreur inattendue
![P1596 [USACO10OCT]Lake Counting S](/img/a7/07a84c93ee476788d9443c0add808b.png)
P1596 [USACO10OCT]Lake Counting S

十六进制编码简介

C语言-入门-精华版-带你走进编程(一)

Introduction to Base64 coding

How to establish rectangular coordinate system in space
随机推荐
Flex flexible box layout
C course design employee information management system
MXone Pro自适应2.0影视模板西瓜视频主题苹果cmsV10模板
Base64编码简介
【音视频】ijkplayer错误码
Luaframwrok handles resource updates
Golang 时间格式整理
About Wireshark's unsuccessful installation of npcap
Ventuz Foundation Series "one step at the door"
Compilation error: "not in executable format: file format not recognized"“
GIS实战应用案例100篇(七十八)-多规合一数据库设计及数据入库
C#课程设计之员工信息管理系统
Unity change default editor
Exe file running window embedding QT window
Easy touch plug-in
C language - Introduction - essence Edition - take you into programming (I)
Generate video using clipout in viz engine
Lua framwrok framework starts
Redis的数据结构
璞华PLM为全场景产品生命周期管理赋能,助力产品主线的企业数字化转型