nginx 配置 https 请求
1,先去这个网站申请一下证书
https://certmall.trustauth.cn/Home/Member/index/id/1521167511.html
上面会教你怎么去做。
2,就是配置自己的nginx了。
记得这个以来一定要安装
yum install openssl openssl-devel
参看下面2个文档。
http://www.cnblogs.com/chen-msg/p/8582374.html
http://www.cnblogs.com/chen-msg/p/7754411.html
3,配置
nginx.conf
#user nobody;
worker_processes 1; #error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info; #pid logs/nginx.pid; events {
worker_connections 1024;
} http {
include mime.types;
default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on;
#tcp_nopush on; #keepalive_timeout 0;
keepalive_timeout 65; #gzip on; server {
listen 80;
server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / {
root /opt/my/html/pc/html/html;
index index.html;
} location /sendTKL/ {
proxy_pass http://127.0.0.1:8688/water-tk-main/tklConvert/;
} location /mytk/ {
proxy_pass http://127.0.0.1:8688/water-tk-main/;
proxy_set_header Host $host:$server_port; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
} # proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#} # deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
} # another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias; # location / {
# root html;
# index index.html index.htm;
# }
#} # HTTPS server
#
server {
listen 443 ssl;
server_name www.ttgwzs.com; #网站域名,和80端口保持一致
ssl on;
ssl_certificate /usr/local/nginx--with-http_stub_status_module/conf/www.ttgwzs.com_bundle.crt; #证书公钥
ssl_certificate_key /usr/local/nginx--with-http_stub_status_module/conf/www.ttgwzs.com.key; #证书私钥
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDH:AESGCM:HIGH:!RC4:!DH:!MD5:!3DES:!aNULL:!eNULL;
ssl_prefer_server_ciphers on;
location / {
proxy_pass http://www.ttgwzs.com;
proxy_redirect off;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Cookie $http_cookie;
#proxy_cookie_path
chunked_transfer_encoding off; } }
}
nginx 配置 https 请求的更多相关文章
- Nginx 配置https请求
通过阿里云生成指定的https证书文件xxxx.key 和 xxxx.pem文件 在阿里云上申请的https证书的是pem格式,转成cer 先在终端cd到文件目录下 然后 openssl x509 - ...
- 【转】Linux下nginx配置https协议访问的方法
一.配置nginx支持https协议访问,需要在编译安装nginx的时候添加相应的模块--with-http_ssl_module 查看nginx编译参数:/usr/local/nginx/sbin/ ...
- nginx配置https双向验证(ca机构证书+自签证书)
nginx配置https双向验证 服务端验证(ca机构证书) 客户端验证(服务器自签证书) 本文用的阿里云签发的免费证书实验,下载nginx安装ssl,文件夹有两个文件 这两个文件用于做服务器http ...
- Nginx 配置https 服务
一.HTTPS 服务 为什么需要HTTPS? 原因:HTTP不安全 1.传输数据被中间人盗用.信息泄露 2.数据内容劫持.篡改 HTTPS协议的实现 对传输内容进行加密以及身份验证 HTTPS加密校验 ...
- nginx配置https转发到tomcat(使用自签名的证书)
一.使用openSSL生成自签名的证书 1.生成RSA私钥 命令:openssl genrsa -des3 -out server.key 1024 说明:生成rsa私钥,des3算法,1024强度, ...
- RedHat 6.6下安装nginx,配置HTTPS
1.安装依赖包 yum -y install pcre-devel openssl-devel zlib-devel 2.下载nginx安装包到服务器上,当前使用版本nginx-1.15.5.tar. ...
- nginx 配置https并自签名证书
2016-10-28 转载请注明出处:http://daodaoliang.com/ 作者: daodaoliang 版本: V1.0.1 邮箱: daodaoliang@yeah.net 参考链接: ...
- Nginx 配置 HTTPS(多域名)
平常开发要求比较低, 依然在用 HTTP, 但到了微信小程序就不行了, 腾讯和苹果都对 API 提出了 HTTPS 的要求. 尤其是苹果, 不仅要求 HTTPS, 还要求 TLS 协议版本要在 1.2 ...
- Nginx配置Https(详细、完整)
Nginx配置Https(详细.完整) 原文链接:请支持原创 前置条件: 在配置https之前请确保下面的步骤已经完成 服务器已经安装nginx并且通过http可以正常访问 不会安装nginx的可以参 ...
随机推荐
- E. Bear and Drawing
E. Bear and Drawing time limit per test 1 second memory limit per test 256 megabytes input stan ...
- C#之Action的实际应用例子
public class DemoAction{ public Action action; public Action<int> action1; public Action<in ...
- 理解本真的 REST 架构风格
1. http://kb.cnblogs.com/page/186516/ 2. http://www.infoq.com/cn/articles/rest-introduction 3. http: ...
- 20165305 苏振龙 《Java 程序设计》第一次测试总结
第一个代码运行结果截图 功能:从1到5305进行求和 第二个代码运行结果截图 代码托管 第三个代码运行结果截图 (1)源文件的名字为Person.java (2)生成2个字节码文件,名字为Person ...
- Hive的join表连接查询的一些注意事项
Hive支持的表连接查询的语法: join_table: table_reference JOIN table_factor [join_condition] | table_reference {L ...
- centos下搭建Jenkins持续集成环境(安装jenkins)
1.安装JDK yum install -y java 2.安装jenkins 添加Jenkins库到yum库,Jenkins将从这里下载安装. 1 wget -O /etc/yum.repos.d/ ...
- 系统调用号、errno
最近老需要看系统调用号,errno,所以这里记一下 CentOS Linux release 7.2.1511 (Core) 3.10.0-327.el7.x86_64 [root@localhost ...
- Service_name 和Sid的区别
Service_name:该参数是由oracle8i引进的.在8i以前,使用SID来表示标识数据库的一个实例,但是在Oracle的并行环境中,一个数据库对应多个实例,这样就需要多个网络服务名,设置繁琐 ...
- win10系统jdk安装和环境变量配置
新换电脑的原因,要重新安装jdk,完整记录一下安装过程 jdk版本用的1.7(公司默认版本) 这是jdk安装目录 更改为D:\jdk\java\jdk1.7 安装jre目录 更改为D:\jdk\ ...
- Oracle之数据库的增删改查和格式的修改
Oracle修改数据 *update语句 格式: update table_name set column1=value1,…[where conditions] 例子: update userinf ...