Nginx(“engine x”)由俄罗斯研发,2004年首次公开发布。它是一个高性能的HTTP和反向代理服务器,同时也提供了IMAP/POP3/SMTP服务,其将源代码以类BSD许可证的形式发布,特点是占有内存少,并发能力强,并发能力确实在同类型的网页服务器中表现较好,有报告表明能支持高达50000个并发连接数。中国大陆使用Nginx网站用户有:百度、京东、新浪、网易、腾讯、淘宝等。

Nginx官网

官网地址:http://nginx.org/

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运维技术,转载本站内容,请注明内容出处”来源刘国华教育“。如若本站内容侵犯了原著者的合法权益,请联系我们进行处理。