linux安装nginx并设置https(openssl)
2015-12-06 13:08
681 查看
linux安装nginx并设置https(openssl)
关键字:linux nginx https openssl
一、安装依赖包
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
一、安装依赖包
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 socket 初步
- nginx代理指定目录
- linux lsof详解
- linux 文件权限
- Linux 执行数学运算
- 10 篇对初学者和专家都有用的 Linux 命令教程
- Linux 与 Windows 对UNICODE 的处理方式
- Ubuntu12.04下QQ完美走起啊!走起啊!有木有啊!
- 解決Linux下Android开发真机调试设备不被识别问题
- 访问Nginx发生SSL connection error的一种情况
- 运维入门
- 运维提升
- Linux 自检和 SystemTap
- OpenSSL编程之RSA
- Ubuntu Linux使用体验
- c语言实现hashmap(转载)
- Linux 信号signal处理机制
- linux下mysql添加用户