Nginx 成功将 重定向http
到。两个应用程序都在端口和https
上启动并运行。但只有端口 上的应用程序可以通过访问 访问。每当我在浏览器中尝试时,它都会显示3000
3001
3000
example.com
example.com/route
Cannot GET /route
server{
listen 80;
server_name example.com;
return 301 https://example.com/$request_uri;
}
server{
listen 443 ssl;
server_name example.com;
ssl_certificate /path/to/file.crt;
ssl_certificate_key /path/to/file.key;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $http_host;
location / {
proxy_pass "http://127.0.0.1:3000";
}
location /route {
proxy_pass "http://127.0.0.1:3001";
}
}