当前位置:网站首页>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
边栏推荐
- 璞华PLM为全场景产品生命周期管理赋能,助力产品主线的企业数字化转型
- Unity change default editor
- C#课程设计之学生教务管理系统
- Un système de gestion de centre commercial pour la conception de cours de technologie d'application de base de données
- Sequence of map implementation classes
- Zohocrm deluge function application time verification
- oracle 插入单引号
- How to establish rectangular coordinate system in space
- tslib库的移植
- C language - Introduction - essence Edition - take you into programming (I)
猜你喜欢
Scite change background color
Abstract classes and interfaces
Wpf: solve the problem that materialdesign:dialoghost cannot be closed
My touch screen production "brief history" 2
animation
Minimap plug-in
Easy touch plug-in
the installer has encountered an unexpected error installing this package
Pulitzer Prize in the field of information graphics - malofiej Award
Dotween plug-in
随机推荐
Chain length value
Initial unity
Unity4.3.1 engine source code compilation process
C#课程设计之员工信息管理系统
E: Unable to locate package ROS melody desktop full
Lua hot update basic grammar
JSON与Object之间转换
IP production stream is so close to me
C language - Introduction - essence Edition - take you into programming (I)
One dimensional array two dimensional array (sort Max insert sort)
Unity dotween sequence animation replay problem.
the installer has encountered an unexpected error installing this package
一条通往服务器所有端口的隧道
Clion toolchains are not configured configure disable profile problem solving
freetype库的移植
Redis的数据结构
Haproxy+kept cluster setup 02
【云原生】微服务之Feign的介绍与使用
Swagger document configuration
Kunlunbase meetup is waiting for you!