我有一个托管服务器,可以同时为域example.de
和提供服务app.example.de
。
我app.example.de
希望我的 Metme/pm2 应用程序能够被使用。
我已经为 Nginx 创建了两个配置文件,但最终出现错误duplicate listen options for X.X.X.X:443
。
default
配置:
server {
listen example.de:80 default_server;
root /var/www/html;
index index.html index.htm index.nginx-debian.html;
server_name example.de;
location / {
try_files $uri $uri/ =404;
}
}
server {
root /var/www/html;
index index.html index.htm index.nginx-debian.html;
server_name example.de; # managed by Certbot
location / {
try_files $uri $uri/ =404;
}
listen example.de:443 ssl ipv6only=on; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/example.de/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/example.de/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
}
meteor
配置
upstream app_nodejs {
server app.example.de;
}
server {
listen app.example.de:443 ssl ipv6only=on; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/example.de/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/example.de/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_name app.example.de;
if ($ssl_protocol = "") {
rewrite ^ https://$server_name$request_uri? permanent;
}
location / {
proxy_pass http://0.0.0.0:3000;
include /etc/nginx/proxy_params;
}
}
我究竟做错了什么?