yum install cargo patch jemalloc-devel pcre-devel cmake gcc gcc-c++
wget http://nginx.org/download/nginx-1.19.1.tar.gz
tar xvzf nginx-1.19.1.tar.gz
git clone https://github.com/cloudflare/zlib.git zlib-cf
cd zlib-cf
make -f Makefile.in distclean
cd ..
git clone https://github.com/grahamedgecombe/nginx-ct.git
git clone https://github.com/eustas/ngx_brotli.git
cd ngx_brotli
git submodule update --init --recursive
cd ..
git clone --recursive https://github.com/cloudflare/quiche
cd nginx-1.19.1
patch -p01 < ../quiche/extras/nginx/nginx-1.16.patch
/usr/sbin/groupadd -f www
/usr/sbin/useradd -g www www
./configure --prefix=/usr/local/nginx \
--build="quiche-$(git --git-dir=../quiche/.git rev-parse --short HEAD)" \
--with-http_v3_module \
--with-openssl=../quiche/deps/boringssl \
--with-quiche=../quiche --with-zlib=../zlib-cf \
--add-module=../nginx-ct \
--add-module=../ngx_brotli \
--user=www \
--group=www \
--with-http_stub_status_module \
--with-http_v2_module \
--with-http_ssl_module \
--with-http_gzip_static_module \
--with-http_realip_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-pcre\
--with-pcre-jit \
--with-ld-opt='-ljemalloc'
make && make install
vim /etc/profile
#末尾增加以下内容
PATH=$PATH:/usr/local/php/bin:/usr/local/nginx/sbin
export PATH
#内容结尾
source /etc/profile
vim /lib/systemd/system/nginx.service
#输入以下内容
[Unit]
Description=nginx - high performance web server
Documentation=http://nginx.org/en/docs/
After=network.target
[Service]
Type=forking
PIDFile=/var/run/nginx.pid
ExecStartPost=/bin/sleep 0.1
ExecStartPre=/usr/local/nginx/sbin/nginx -t -c /usr/local/nginx/conf/nginx.conf
ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
LimitNOFILE=1000000
LimitNPROC=1000000
LimitCORE=1000000
[Install]
WantedBy=multi-user.target
#内容结束
chmod +x /lib/systemd/system/nginx.service
systemctl enable nginx
vim /usr/local/nginx/conf/nginx.conf
#输入以下内容
user www www;
worker_processes auto;
error_log /data/wwwlogs/error_nginx.log crit;
pid /var/run/nginx.pid;
worker_rlimit_nofile 51200;
events {
use epoll;
worker_connections 51200;
multi_accept on;
}
http {
include mime.types;
default_type application/octet-stream;
server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 1024m;
client_body_buffer_size 10m;
sendfile on;
tcp_nopush on;
keepalive_timeout 120;
server_tokens off;
tcp_nodelay on;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 128k;
fastcgi_intercept_errors on;
#Gzip Compression
gzip on;
gzip_buffers 16 8k;
gzip_comp_level 6;
gzip_http_version 1.1;
gzip_min_length 256;
gzip_proxied any;
gzip_vary on;
gzip_types
text/xml application/xml application/atom+xml application/rss+xml application/xhtml+xml image/svg+xml
text/javascript application/javascript application/x-javascript
text/x-json application/json application/x-web-app-manifest+json
text/css text/plain text/x-component
font/opentype application/x-font-ttf application/vnd.ms-fontobject
image/x-icon;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
##Brotli Compression
#brotli on;
#brotli_comp_level 6;
#brotli_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript image/svg+xml;
##If you have a lot of static files to serve through Nginx then caching of the files' metadata (not the actual files' contents) can save some latency.
#open_file_cache max=1000 inactive=20s;
#open_file_cache_valid 30s;
#open_file_cache_min_uses 2;
#open_file_cache_errors on;
######################## default ############################
server {
listen 80;
server_name _;
access_log /data/wwwlogs/access_nginx.log combined;
root /data/wwwroot/default;
index index.html index.htm index.php;
#error_page 404 /404.html;
#error_page 502 /502.html;
location /nginx_status {
stub_status on;
access_log off;
allow 127.0.0.1;
deny all;
}
location ~ [^/]\.php(/|$) {
#fastcgi_pass remote_php_ip:9000;
fastcgi_pass unix:/dev/shm/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ {
expires 30d;
access_log off;
}
location ~ .*\.(js|css)?$ {
expires 7d;
access_log off;
}
location ~ ^/(\.user.ini|\.ht|\.git|\.svn|\.project|LICENSE|README.md) {
deny all;
}
}
########################## vhost #############################
include vhost/*.conf;
}
#输入内容结束
mkdir -p /data/wwwlogs/
mkdir -p /data/wwwroot/default
mkdir -p /usr/local/nginx/conf/vhost
vim /data/wwwlogs/access_nginx.log
service nginx start
service nginx status
#安装PHP7.4
yum install autoconf automake bison libxml2 libxml2 openssl-devel sqlite-devel libcurl-devel libpng-devel libjpeg-devel freetype-devel libicu-devel libsodium-devel argon2 libargon2-devel libxslt-devel libzip-devel
dnf --enablerepo=PowerTools install oniguruma-devel
yum -y install git automake gcc gcc-c++ libtool
git clone https://github.com/skvadrik/re2c.git re2c
cd re2c
mkdir -p m4
./autogen.sh && ./configure
make && make install
cd ..
wget https://www.php.net/distributions/php-7.4.8.tar.gz
tar xvzf https://www.php.net/distributions/php-7.4.8.tar.gz
cd php-7.4.8
./configure --prefix=/usr/local/php \
--with-config-file-path=/usr/local/php/etc \
--with-config-file-scan-dir=/usr/local/php/etc/php.d \
--with-fpm-user=www \
--with-fpm-group=www \
--enable-mbstring \
--enable-ftp \
--enable-gd \
--enable-opcache \
--enable-gd-jis-conv \
--enable-mysqlnd \
--enable-pdo \
--enable-sockets \
--enable-fpm \
--enable-xml \
--enable-soap \
--enable-pcntl \
--enable-cli \
--with-freetype \
--with-jpeg \
--with-openssl \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-pear \
--with-zlib \
--with-iconv \
--with-curl \
--enable-bcmath \
--enable-shmop \
--enable-exif \
--enable-sysvsem \
--enable-mbregex \
--with-password-argon2 \
--with-sodium=/usr/local \
--with-mhash \
--enable-ftp \
--enable-intl \
--with-xsl \
--with-gettext \
--with-zip \
--disable-debug \
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/:
vim /lib/systemd/system/php-fpm.service
#输入以下内容
[Unit]
Description=The PHP FastCGI Process Manager
Documentation=http://php.net/docs.php
After=network.target
[Service]
Type=simple
PIDFile=/usr/local/php/var/run/php-fpm.pid
ExecStart=/usr/local/php/sbin/php-fpm --nodaemonize --fpm-config /usr/local/php/etc/php-fpm.conf
ExecReload=/bin/kill -USR2 $MAINPID
LimitNOFILE=1000000
LimitNPROC=1000000
LimitCORE=1000000
[Install]
WantedBy=multi-user.target
#输入完成
#安装mariadb10.5
vim /etc/yum.repos.d/MariaDB.repo
#输入以下内容
# MariaDB 10.5 CentOS repository list - created 2020-08-01 16:01 UTC
# http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.5/centos8-amd64
module_hotfixes=1
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
#输入内容结束
sudo dnf install MariaDB-server
sudo systemctl start mariadb
mysql_secure_installation
#默认密码为空,需要修改密码,不设置unix socket验证方式,其他选no
发表回复