Nginx官网
官网地址:
nginx在编译安装时需要一些zlib,openssl,pcre等软件支持,所以要预先安装以下软件
dnf install -y gcc gcc-c++ make libtool wget pcre pcre-devel zlib zlib-devel openssl openssl-devel
编译安装
tar zxf nginx-1.24.0.tar.gz
cd nginx-1.24.0
./configure --prefix=/usr/local/nginx-1.24.0 --user=nginx --group=nginx --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_stub_status_module --with-http_gzip_static_module --with-pcre --with-stream --with-stream_ssl_module --with-stream_realip_module
make
make install
新建自定义配置文件目录
mkdir /usr/local/nginx-1.24.0/conf/vhosts
进自定义目录
cd /usr/local/nginx-1.24.0/conf/vhosts
more www.liuguohua.com.conf
# HTTPS server
server {
listen 443 ssl;
server_name www.liuguohua.com;
ssl_certificate /usr/local/nginx-1.24.0/conf/liuguohua.com/lgh.pem;
ssl_certificate_key /usr/local/nginx-1.24.0/conf/liuguohua.com/lgh.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location / {
root /data/www/hyrc.hnycrc.com;
index index.html index.htm;
}
}
修改主配置文件nginx.conf,在最后增加一个行,把前面定义的配置文件包含进来
。。。
include vhosts/*.conf;
}
重启服务
/usr/local/nginx-1.24.0/bin/nginx -t
/usr/local/nginx-1.24.0/bin/nginx -s reload
声明:欢迎大家光临本站,学习IT运维技术,转载本站内容,请注明内容出处”来源刘国华教育“。如若本站内容侵犯了原著者的合法权益,请联系我们进行处理。