我有sudo docker run -d --restart unless-stopped -it -v $(pwd):/data -p 81:80 maptiler/tileserver-gl
跑步。我可以访问http://mypage.com:81就好了。但是,我想访问https://mypage.com:81。我有一个有效的证书,但它无法使用https协议。下面是我的nginx.conf
文件。
server {
listen 80;
listen [::]:80 default_server;
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
server_name mypage.com;
root /usr/share/nginx/html;
ssl_certificate "/etc/pki/nginx/certs/mypage.com.crt";
ssl_certificate_key "/etc/pki/nginx/certs/mypage.com.key";
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 10m;
ssl_ciphers PROFILE=SYSTEM;
ssl_prefer_server_ciphers on;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
proxy_pass http://localhost:80;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
}