- http协议访问本机资源
server {
listen 9290;
location / {
default_type text/html;
alias /opt/nginx/html;//本机资源目录
}
}
- https协议访问本机资源
server {
listen 9290 ssl;
ssl_certificate xxx;
ssl_certificate_key xxx;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_prefer_server_ciphers on;
client_max_body_size 50m;
location / {
default_type text/html;
alias /opt/nginx/html;//本机资源目录
}
}
报错:curl: (51) Unable to communicate securely with peer: requested domain name does not match the server's certificate.
解决:curl加参数 --insecure
参考下面博客:
https://blog.youkuaiyun.com/wyunpeng/article/details/115462462