我的NginX安装创建了一个名为vhosts的子文件夹,其中包含我服务器上每个站点的单独文件。我尝试启动Node.js应用,但我无法弄清楚我的配置有什么问题。
我正常地将我的网站添加到cPanel,它为我创建了这个虚拟主机文件,这就是我正在编辑的内容。这是文件内容:
upstream shopto.fund {
server 127.0.0.1:3000;
}
server {
error_log /var/log/nginx/vhost-error_log warn;
listen my.ip.addr.vals:80;
listen [::]:80;
server_name shopto-fund.trentpages.com shopto.fund www.shopto-fund.trentpages.com www.shopto.fund my.ip.addr.vals;
access_log /usr/local/apache/domlogs/shopto-fund.trentpages.com-bytes_log bytes_log;
access_log /usr/local/apache/domlogs/shopto-fund.trentpages.com combined;
root /home/trentpag/public_html/shopto;
#location / {
location ~*.*\.(3gp|gif|jpg|jpeg|png|ico|wmv|avi|asf|asx|mpg|mpeg|mp4|pls|mp3|mid|wav|swf|flv|html|htm|txt|js|css|exe|zip|tar|rar|gz|tgz|bz2|uha|7z|doc|docx|xls|xlsx|pdf|iso)$ {
expires 1M;
try_files $uri @backend;
}
location / {
error_page 405 = @backend;
add_header X-Cache "HIT from Backend"
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://shopto.fund/;
proxy_redirect off;
include proxy.inc;
include microcache.inc;
}
location @backend {
internal;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://shopto.fund/;
proxy_redirect off;
include proxy.inc;
include microcache.inc;
}
location ~ .*\.(php|jsp|cgi|pl|py)?$ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://shopto.fund/;
proxy_redirect off;
include proxy.inc;
include microcache.inc;
}
location ~ /\.ht {
deny all;
}
}
当我加载我的网站shopto.fund时,我得到一个空白页面。当我加载shopto.fund:3000我的网站按预期加载时,所以我相信我的Node.js配置没有任何问题。我已经在这里工作了大约5个小时,我可以想到这个文件的几乎所有配置和变化。任何帮助都将非常赞赏。谢谢!