Nginx支持ssl的方法:在nginx配置文件中添加支持ssl传输协议,例如:shell> vim /usr/local/nginx/conf/nginx.conf------------------------
Nginx支持ssl的方法:
在nginx配置文件中添加支持ssl传输协议,例如:
shell> vim /usr/local/nginx/conf/nginx.conf------------------------------------------------
user apache apache;
worker_processes 2;
error_log logs/error_nginx.log;
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_nginx.log main;
sendfile on;
tcp_nopush on;
keepalive_timeout 65;
gzip on;
server {
listen 443;
server_name www.yisu.com;
charset uft-8;
access_log logs/www.access.log main;
root /var/www/html;
location / {
index index.html index.htm;
}
ssl on;
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 {
listen 80;
server_name www.yisu.com;
charset uft-8;
access_log logs/www.access.log main;
root /var/www/html;
location / {
proxy_pass http://10.10.54.150:1500;
}
}
#当用户使用http协议浏览该网站时,自动跳转到10.10.54.150:1500上
------------------------------------------------
--结束END--
本文标题: nginx如何支持ssl
本文链接: https://lsjlt.com/news/114975.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0