Linux安装nginx并设置https(openssl
2017-05-19 10:00
369 查看
一、安装依赖包
1.$sudo apt-get install openssl
或者$sudo apt-get install libssl-dev
2.$sudo apt-get install libpcre3 libpcre3-dev
二、安装nginx
1.$cd /usr/local/src
2.sudo wget http://nginx.org/download/nginx-1.2.2.tar.gz
3.$sudo tar -xzvf nginx-1.2.2.tar.gz
4.$cd nginx-1.2.2
5.$./configure --prefix=/opt/nginx --with-http_stub_status_module --with-http_ssl_module --with-zlib --with-pcre
6.$make && make install
三、创建不受信任的SSL Key:
$ cd /usr/local/nginx/conf
$ openssl genrsa -des3 -out server.key 1024
$ openssl req -new -key server.key -out server.csr
$ cp server.key server.key.org
$ openssl rsa -in server.key.org -out server.key
$ openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
四、编辑 nginx.conf
server {
server_name YOUR_DOMAINNAME_HERE;
listen 443;
ssl on;
#certfile
ssl_certificate /usr/local/nginx/conf/server.crt;
#keyfile
ssl_certificate_key /usr/local/nginx/conf/server.key;
location / {
#to host name
proxy_pass http://127.0.0.1:8080;
root html;
index index.html index.htm;
}
}
1.$sudo apt-get install openssl
或者$sudo apt-get install libssl-dev
2.$sudo apt-get install libpcre3 libpcre3-dev
二、安装nginx
1.$cd /usr/local/src
2.sudo wget http://nginx.org/download/nginx-1.2.2.tar.gz
3.$sudo tar -xzvf nginx-1.2.2.tar.gz
4.$cd nginx-1.2.2
5.$./configure --prefix=/opt/nginx --with-http_stub_status_module --with-http_ssl_module --with-zlib --with-pcre
6.$make && make install
三、创建不受信任的SSL Key:
$ cd /usr/local/nginx/conf
$ openssl genrsa -des3 -out server.key 1024
$ openssl req -new -key server.key -out server.csr
$ cp server.key server.key.org
$ openssl rsa -in server.key.org -out server.key
$ openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
四、编辑 nginx.conf
server {
server_name YOUR_DOMAINNAME_HERE;
listen 443;
ssl on;
#certfile
ssl_certificate /usr/local/nginx/conf/server.crt;
#keyfile
ssl_certificate_key /usr/local/nginx/conf/server.key;
location / {
#to host name
proxy_pass http://127.0.0.1:8080;
root html;
index index.html index.htm;
}
}
相关文章推荐
- linux安装nginx并设置https(openssl)
- [转]如何在linux系统下安装nginx、pcre、zlib、openssl工具
- Linux环境下安装Nginx+Pcre+OpenSSL
- Linux下Nginx安装的方法(pcre和openssl)
- linux 下安装nginx经常出现 make[2]: Leaving directory `/usr/local/ssl' 或make[2]: Leaving directory `/usr/local/openssl' 找不到的情况解决方法
- 如何在linux系统下安装nginx、pcre、zlib、openssl工具
- Linux-Nginx+JDK+tomcat安装设置
- nginx https配置详解,linxu环境nginx下http升级到https——linux安装web服务器17
- linux下安装nginx、pcre、zlib、openssl
- 在linux(centos)使用openssl生成https证书并配置到nginx的实现过程
- linux/centos安装nginx常见错误及解决办法【make错误,需要yum -y install openssl openssl-devel或者自己下载然后重新./configure】
- CentOS7 下安装 Nginx 支持 HTTPS 并设置为系统服务
- Linux环境下安装Nginx+Pcre+OpenSSL
- Linux环境下安装Nginx+Pcre+zlib+OpenSSL
- [转]Linux环境下安装Nginx+Pcre+zlib+OpenSSL
- Linux上设置nginx支持https
- Linux环境下安装Nginx+Pcre+zlib+OpenSSL
- Linux Nginx Web环境安装SSL证书后强行指向HTTPS方法
- Linux环境下安装Nginx+Pcre+OpenSSL
- tony_nginx_01_如何在linux系统下安装nginx、pcre、zlib、openssl工具