1.编辑nginx.conf文件
vim cd /usr/local/nginx/conf/nginx.conf
2.添加一下配置禁止IP方式访问,使用域名访问
#http格式
server {
listen 80 default_server;
server_name _;return403;}
#https格式
server {
ssl_certificate /app/key/server.crt;
ssl_certificate_key /app/key/server.key;
listen 443 ssl default_server;
listen 1443 ssl default_server;
listen 18080 ssl default_server;
server_name _;return403;}
#nginx配置ssl连接
server {
listen 443 ssl;
server_name localhost;
ssl_certificate ../ssl/chat.crt;
ssl_certificate_key ../ssl/chat.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_protocols TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
location /redfish {
proxy_pass https://127.0.0.1:8080;}}
3.重启nginx配置(访问出现403则表示配置成功)
nginx -s reload
本文转载自: https://blog.csdn.net/qq_52231508/article/details/139415506
版权归原作者 小先生ノ 所有, 如有侵权,请联系我们删除。
版权归原作者 小先生ノ 所有, 如有侵权,请联系我们删除。