我有三个网站使用NodeJS
。我希望使用NginX
发布,因此已安装了所有要求。对于我的域名,我想发布https
,而对于子域名,我想发布http
。我的问题是子域的发布失败了。
我已在/sites-enabled
文件夹中编写了配置文件。
/默认:
server {
listen 443 ssl;
server_name www.my-domain.com;
ssl_certificate /var/www/my-domain/server/config/certificates/www_my-domain_com.crt;
ssl_certificate_key /var/www/my-domain/server/config/certificates/www_my-domain_com_nokey.key;
location / {
proxy_pass http://localhost:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
server {
listen 80;
server_name www.my-domain.com my-domain.com;
return 301 https://www.my-domain.com$request_uri;
}
server {
listen 443;
server_name my-domain.com;
return 301 https://www.my-domain.com$request_uri;
}
/subdomain.my-domain.com:
server {
listen 80;
server_name crm.my-domain.com;
access_log /var/log/nginx/crm.my-domain.com.log;
location / {
proxy_pass http://localhost:8081;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
/subdomain2.my-domain.com:
server {
listen 80;
server_name support.my-domain.com;
access_log /var/log/nginx/support.my-domain.com.log;
location / {
proxy_pass http://localhost:8082;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}