当前位置:网站首页>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
边栏推荐
- Golang url的编码和解码
- Haproxy+kept build 01
- Product creation and commercial realization of chat robot (according to La Ma Bang - Dr. Wang Jingjing - speech)
- About the problem that the editor and the white screen of the login interface cannot be found after the location of unityhub is changed
- Pulitzer Prize in the field of information graphics - malofiej Award
- Clion toolchains are not configured configure disable profile problem solving
- Ilruntime learning - start from scratch
- Detailed explanation of all transfer function (activation function) formulas of MATLAB neural network
- 使用base64编码传图片
- A tunnel to all ports of the server
猜你喜欢
Unity2019_ Natural ambient light_ Sky box
[set theory] order relation (hastu example | divisive relation hastu | inclusive relation hastu | refinement relation hastu)
Basic operation and process control 2
GIS实战应用案例100篇(七十八)-多规合一数据库设计及数据入库
图像处理8-CNN图像分类
C#课程设计之员工信息管理系统
My touch screen production "brief history" 2
php-fpm软件的安装+openresty高速缓存搭建
【云原生】微服务之Feign的介绍与使用
C course design employee information management system
随机推荐
Introduction to Base64 coding
the installer has encountered an unexpected error installing this package
Base64编码简介
Base64 and base64url
[USACO12MAR]Cows in a Skyscraper G(状态压缩dp)
Student educational administration management system of C # curriculum design
Unity change default editor
796 · 开锁
C course design employee information management system
Mutual call between Lua and C #
[set theory] order relation (hastu example | divisive relation hastu | inclusive relation hastu | refinement relation hastu)
2021-10-19
Use filechannel to copy files
[cloud native] introduction and use of feign of microservices
[audio and video] ijkplayer error code
LinkList
Delete the last character of the string in golang
MAE
Are you still watching the weather forecast on TV?
Osgearth north arrow display