[root@Monitor install]# tar xf nginx-1.10.3.tar.gz
[root@Monitor install]# cd nginx-1.10.3
[root@Monitor nginx-1.10.3]#
[root@Monitor nginx-1.10.3]# ./configure --prefix=/usr/local/nginx2 \ ##重定向安装路径
> --with-http_stub_status_module \
> --with-http_ssl_module \
> --with-http_realip_module \
> --with-http_gzip_static_module \
> --with-http_stub_status_module \
> --with-http_stub_status_module \
> --with-http_v2_module \ ###启用https2.0模块
> --with-openssl=/tmp/install/openssl-1.1.0e
checking for OS
+ Linux 2.6.32-642.3.1.el6.x86_64 x86_64
checking for C compiler ... found
+ using GNU C compiler
+ gcc version: 4.4.7 20120313 (Red Hat 4.4.7-17) (GCC)
checking for gcc -pipe switch ... found
checking for -Wl,-E switch ... found
checking for gcc builtin atomic operations ... found
checking for C99 variadic macros ... found
checking for zlib library ... found
creating objs/Makefile
Configuration summary
+ using system PCRE library
+ using OpenSSL library: /tmp/install/openssl-1.1.0e
+ md5: using OpenSSL library
+ sha1: using OpenSSL library
+ using system zlib library
nginx path prefix: "/usr/local/nginx2"
nginx binary file: "/usr/local/nginx2/sbin/nginx"
nginx modules path: "/usr/local/nginx2/modules"
nginx configuration prefix: "/usr/local/nginx2/conf"
nginx configuration file: "/usr/local/nginx2/conf/nginx.conf"
nginx pid file: "/usr/local/nginx2/logs/nginx.pid"
nginx error log file: "/usr/local/nginx2/logs/error.log"
nginx http access log file: "/usr/local/nginx2/logs/access.log"
nginx http client request body temporary files: "client_body_temp"
nginx http proxy temporary files: "proxy_temp"
nginx http fastcgi temporary files: "fastcgi_temp"
nginx http uwsgi temporary files: "uwsgi_temp"
nginx http scgi temporary files: "scgi_temp"
[root@Monitor nginx-1.10.3]#make && make install
备注:
./configure --prefix=/usr/local/nginx2 --with-http_stub_status_module --with-http_ssl_module --wi
th-http_realip_module --with-http_gzip_static_module --with-http_stub_status_module --with-http_stub_status_module --with-http_
v2_module --with-openssl=/tmp/install/openssl-1.1.0e
(3)配置nginx.conf文件中listen 80 return 301 https://$host$request_uri; 和listen 443 ssl http2;即可
server {
listen 80 ;
server_name localhost;
return 301
}
server {
listen 443 ssl http2 default_server;
server_name localhost;
ssl_certificate cert.pem;
ssl_certificate_key cert.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location / {
root html;
index index.html index.htm;
}
}
(4)重新加载nginx