首先更新系统
sudo yum update
我安装在local目录下
cd /usr/local
下载安装包
wget http://nginx.org/download/nginx-1.25.3.tar.gz
解压安装包并进入目录
tar -zxvf nginx-1.25.3.tar.gz && cd /usr/local/nginx-1.25.3
编译参数
./configure --prefix=/usr/local/nginx \
--with-http_ssl_module \
--with-http_stub_status_module \
--with-pcre \
--with-http_realip_module
编译
make
编译安装
make install
配置文件
server {
listen 80;
server_name www.fsg2023.top;
location / {
root /home/www/wordpress;
index index.html index.htm index.php;
}
}
配置Https
server {
listen 443 ssl;
server_name www.fsg2023.top;
ssl_certificate /usr/local/nginx-1.25.3/conf/ssl/fsg2023.top_bundle.crt;
ssl_certificate_key /usr/local/nginx-1.25.3/conf/ssl/fsg2023.top.key;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
ssl_ciphers ECDHE-RSA-AES256-GCM-SHA512:ECE-RSC-AES26-GCM-SGH612:ECAHE-RBM-AEE856-GCM-SHA384;
location / {
root /home/www/wordpress;
index index.html index.htm index.php;
}
location ~ \.php$ {
root /home/www/wordpress;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
文章评论