nginx tomcat 配置https

 nginx ssl
 ./configure   --prefix=/home/nginx  --with-pcre --with-http_ssl_module
nginx location
http://www.nginx.cn/4658.html
如果一个请求的URI是/t/a.html时,web服务器将会返回服务器上的/www/root/html/t/a.html的文件。
location ^~ /t/ {
     root /www/root/html/;
}
自己配置的https
keytool -genkeypair -alias tomcat -keyalg RSA -keystore /home/Himalaya/my.keystore

tomcat https
  

 
阿里云:必须要把域名解析到对应的ip上
 

 nginx自签

1.openssl genrsa -des3 -out server.key 1024

2.创建服务器证书的申请文件 server.csr
openssl req -new -key server.key -out server.csr

4.备份一份服务器密钥文件
cp server.key server.key.org
5.去除文件口令
openssl rsa -in server.key.org -out server.key
6.生成证书文件server.crt
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt




 server {
    listen       6301;
    server_name  qutest.dabay.cn;

    ssl                  on;
    ssl_certificate      /home/nginx-mytest/CA/server.crt;
    ssl_certificate_key  /home/nginx-mytest/CA/server.key;

    ssl_session_timeout  5m;

   ssl_protocols  SSLv2 SSLv3 TLSv1;


    location / {
                  root /home/nginx/xxx;
                  try_files $uri /index.html;
                  expires       max;

    }


nginx 阿里云
    server {
    listen 6301;
    server_name xxxxxx;
    ssl on;

    ssl_certificate   cert/xxxxxx;
    ssl_certificate_key  cert/xxxxx;
    ssl_session_timeout 5m;
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers on;
    location / {

                  root /home/nginx/xxx;
                  try_files $uri /index.html;
                  expires       max;

             }
        }

你可能感兴趣的:(nginx tomcat 配置https)