我有一个域名,例如:domain.online
,我正在尝试添加到使用nginx运行的节点服务器中。
目前有3个其他网站在运行,但他们使用node.js
来运行特定端口。所以端口3000
9000
和9001
正在使用node
运行它们。
我在domain
目录中有一个静态html网站,位于~/domain
但是当我运行以下内容并在浏览器中转到域时,Chrome会显示错误Page isn't working
和开发工具说There are too many redirect
。
有人可以协助我让静态html网站运行,而无需节点告诉使用哪个端口。
# HTTP - redirect all requests to HTTPS:
server {
listen 8080;
listen [::]:8080;
return 301 https://$host$request_uri;
}
# HTTPS - proxy requests on to local Node.js app:
server {
listen 443;
root /domain;
server_name domain.online;
ssl on;
# Use certificate and key provided by Let's Encrypt:
ssl_certificate /etc/letsencrypt/live/domain.online/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/domain.online/privkey.pem;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';
# Pass requests for / to localhost:9001:
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://localhost:8080;
proxy_ssl_session_reuse off;
proxy_set_header Host $http_host;
proxy_cache_bypass $http_upgrade;
proxy_redirect off;
}
}