问题描述
我在服务器块中有一个子域,例如sub.example.com
,我已经设置了certbot,它已成功用于https。
因此,端口80
和443
正常工作。
我在服务器上,端口8080
詹金斯和端口3000
上运行了其他应用程序。
我在这些端口的服务器块中放置了liten指令,并尝试使用sub.example.com:8080
和sub.example.com:3000
。但这不起作用。
我也想对它们启用https。
我该怎么办,有可能吗?
下面是我的服务器块的配置,我将其放在sites-enabled
中。
server {
listen 8080;
listen 3000; # these two doesn't work
server_name sub.example.com;
root /var/lib/jenkins/workspace/project/dist;
index index.html index.htm;
location / {
try_files $uri /index.html =404;
}
listen 8080;
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/sub.example.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/sub.example.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-Nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = sub.example.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
server_name sub.example.com;
listen 80;
return 404; # managed by Certbot
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)