Edw*_*ard 6 dns nginx nginx-location nginx-config
我正在尝试配置default.conf以/etc/nginx/conf.d显示位于 的简单登录页面/home/ubuntu/project-source/company/entry/index.html。
据我所知,域已正确设置以指向服务器
A: test24.company.io -> <aws-elastic-IP>
Run Code Online (Sandbox Code Playgroud)
默认.conf:
server {
listen 80;
server_name localhost;
index index.html;
location / {
root /home/ubuntu/project-source/company/entry;
}
}
server {
server_name test24.company.io www.test24.company.io;
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/test24.company.io/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/test24.company.io/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 = test24.company.io) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name test24.company.io www.test24.company.io;
return 404; # managed by Certbot
}
Run Code Online (Sandbox Code Playgroud)
附加问题:该项目将在 2 个子域上运行 2 个进程,比如说sub1和,它们将分别在和sub2上运行 ,我如何配置以指向/代理这些进程?localhost:3001localhost:3002default.conf
好吧,经过许多天和几个小时的绞尽脑汁后,我得出了这个解决方案:
在 GoDaddy 的 DNS 上,我添加了这些记录:
A: test24.company.io -> <aws-elastic-IP>
A: sub1.test24.company.io -> <aws-elastic-IP>
A: sub2.test24.company.io -> <aws-elastic-IP>
注意: 所有 3 条记录都指向同一个弹性 IP,无需为每个子域设置单独的弹性 IP。
nginxconf文件配置如下: https://gist.github.com/ahmed-abdelazim/b3536c1780afc4215ef57633bbe77a88
这篇文章是关于为服务器上的不同端口设置 nginx 代理的非常有用的指南。
nginx 配置文件中的所有其余内容均由 certbot 生成,它还管理从 http 到 https 的重定向。
mods 注意:由于某种原因,我似乎无法在这个答案中格式化 GitHubGist 的代码。
| 归档时间: |
|
| 查看次数: |
27965 次 |
| 最近记录: |