【发布时间】:2021-02-02 19:31:26
【问题描述】:
我在 AWS Ubuntu 服务器上并且已经验证了我的域和来自证书管理器的证书,但我无法在我的服务器上使用它,似乎它用于外部流量。无论如何,我使用了来自https://hackernoon.com/easy-lets-encrypt-certificates-on-aws-79387767830b的letsencrypt指南
然后进入我的 etc/nginx/sites-available 并编辑 mysite.com 的虚拟服务器文件。设置如下。我有两个子域,asdf.mysite.com asdf2.mysite.com,主域有 wordpress。现在,主站点重定向到第一个子域 asdf.mysite.com。如何在我的 nginx 服务器上获取 https 并将其直接发送到主站点?
server {
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
ssl_certificate /etc/letsencrypt/live/mysite.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/mysite.com/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/mysite.com/chain.pem;
server_name mysite.com www.mysite.com;
root /var/www/wordpress;
index index.php index.html index.htm;
client_max_body_size 100M;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
fastcgi_connect_timeout 300s;
fastcgi_param PHP_VALUE "upload_max_filesize = 50M \n post_max_size=51M";
fastcgi_read_timeout 300s;
fastcgi_send_timeout 300s;
}
}
【问题讨论】: