云服务器网:购买云服务器和VPS必上的网站!

nginx:nginx如何支持ssl

nginx如何支持sslnginx支持ssl的方法:在nginx配置文件中添加支持ssl传输协议,例如:shell>vim/usr/local/nginx/conf/nginx.conf————————————-

nginx如何支持SSL

nginx支持ssl的方法:

在nginx配置文件中添加支持ssl传输协议,例如:

shell>vim/usr/local/nginx/conf/nginx.conf

------------------------------------------------

userapacheapache;

worker_processes2;

error_loglogs/error_nginx.log;

pidlogs/nginx.pid;

events{

worker_connections1024;

}

http{

includemime.types;

default_typeapplication/octet-stream;

log_formatmain'$remote_addr-$remote_user[$time_local]"$request"'

'$status$body_bytes_sent"$http_referer"'

'"$http_user_agent""$http_x_forwarded_for"';

access_loglogs/access_nginx.logmain;

sendfileon;

tcp_nopushon;

keepalive_timeout65;

gzipon;

server{

listen443;

server_namewww.yisu.com;

charsetuft⑻;

access_loglogs/www.access.logmain;

root/var/www/html;

location/{

indexindex.htmlindex.htm;

}

sslon;

ssl_certificate/usr/local/nginx/conf/ssl/client.pem;

ssl_certificate_key/usr/local/nginx/conf/ssl/client.key;

}

}

--------------------------------------------------------

#上面的配置只支持https://www.yisu.com访问,由于监听端口只开了443端口,普通的http协议的80端口并未开放

#要开放http和https,再加上下面这一条server

------------------------------------------------

server{

listen80;

server_namewww.yisu.com;

charsetuft⑻;

access_loglogs/www.access.logmain;

root/var/www/html;

location/{

proxy_passhttp://10.10.54.150:1500;

}

}

#当用户使用http协议浏览该网站时,自动跳转到10.10.54.150:1500上

------------------------------------------------

本文来源:https://www.yuntue.com/post/61264.html | 云服务器网,转载请注明出处!

关于作者: yuntue

云服务器(www.yuntue.com)是一家专门做阿里云服务器代金券、腾讯云服务器优惠券的网站,这里你可以找到阿里云服务器腾讯云服务器等国内主流云服务器优惠价格,以及海外云服务器、vps主机等优惠信息,我们会为你提供性价比最高的云服务器和域名、数据库、CDN、免费邮箱等企业常用互联网资源。

为您推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注