简体   繁体   English

Ubuntu云服务器运行node.js应用程序

[英]Ubuntu cloud server run node.js application

I have a ubuntu server on the cloud where i have my app running. 我在运行我的应用程序的云上有一个ubuntu服务器。

I am having a few issues: 我有几个问题:

  1. first when clicking on the url it shows all the files 首先,在单击URL时,它将显示所有文件
  2. How do i get it to render the correct page in my case login page? 如何获得在案例登录页面中呈现正确页面的信息?

I use the following command to run node: node server.js 我使用以下命令运行节点:node server.js

Any ideas would be great 任何想法都很棒

Looks insufficient information in your question. 在您的问题中看起来信息不足。 Below is the steps what i done on my VPS. 以下是我在VPS上执行的步骤。

As i came form ruby background and done some work on Nginx combo with thin, unicorn and passenger So I preferred to use Nginx as a front end server, which in this case proxies the requests to a node.js server. 当我来自ruby的背景并且在瘦,独角兽和乘客的Nginx组合上做了一些工作时,所以我更喜欢使用Nginx作为前端服务器,在这种情况下,它将代理请求发送到node.js服务器。

Below is Nginx Config: 以下是Nginx Config:

upstream shop {
  server 127.0.0.1:3000;
}

server {
  listen 80;# default deferred;
  server_name localhost;
  root /var/www/shop/public;
  try_files $uri/index.html $uri @shop;

  location @shop {
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_redirect off;
    proxy_pass http://shop; 
  }

  error_page 500 502 503 504 /500.html;
  client_max_body_size 4G;
  keepalive_timeout 10;

} }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM