域名已经处理 不增加 http 块,可以正常访问,证书正常,增加了 http 块就报证书错误,请教一下。全部都 docker 启动 我的 nginx 配置 如下
worker_processes auto; # 自动设置为 CPU 核心数
worker_rlimit_nofile 100000; # 增加每个 worker 进程可以打开的文件数
events {
worker_connections 4096; # 增加每个 worker 进程的最大连接数
multi_accept on; # 允许每个 worker 进程同时接受多个连接
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
gzip on;
server {
listen 80;
server_name es.x.com.cn;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl;
server_name es.x.com.cn;
# SSL 证书和密钥配置
ssl_certificate /usr/share/nginx/html/ssl-qianduan/es.x.com.cn_bundle.pem;
ssl_certificate_key /usr/share/nginx/html/ssl-qianduan/es.x.com.cn.key;
# SSL 优化配置
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256';
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
ssl_stapling on;
ssl_stapling_verify on;
location / {
root /usr/share/nginx/html; # 路径改成自己的 dist 路径
index index.html index.htm;
try_files $uri $uri/ /index.html; #解决刷新页面变成 404 问题的代码
}
location /prod-api/ {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://172.16.238.13:8089/;
}
}
server {
listen 80;
server_name esb.x.com.cn;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl;
server_name esb.x.com.cn;
# SSL 证书和密钥配置
ssl_certificate /usr/share/nginx/html/ssl-houduan/esb.x.com.cn_bundle.pem;
ssl_certificate_key /usr/share/nginx/html/ssl-houduan/esb.x.com.cn.key;
location / {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://172.16.238.13:8089/;
}
}
# 阻止通过 IP 地址或未知的域名访问
server {
listen 80 default_server;
listen 443 default_server ssl;
# SSL 证书和密钥配置
ssl_certificate /usr/share/nginx/html/ssl-houduan/esb.x.com.cn_bundle.pem;
ssl_certificate_key /usr/share/nginx/html/ssl-houduan/esb.x.com.cn.key;
server_name es.x.com.cn;
return 444; # 返回一个非标准的状态码,通常用于阻止客户端的访问
}
}
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.