簡體   English   中英

使用 google Compute Engine 和 nginx 部署 angular 7 應用程序-不顯示任何內容

[英]Deploy angular 7 app with google Compute Engine and nginx - display nothing

在谷歌計算引擎上部署我的 angular 7 應用程序並使用我的網站 IP 地址配置 nginx 后,路由工作正常(我在地址欄中看到它......)但屏幕上沒有任何顯示並收到錯誤502 Bad Gateway ,請知道?

    nginx config:
   server {
   listen 80 default_server;
   listen [::]:80 default_server;
   server_name COMPUTE_ENGINE_INSTANCE_EXTERNAL_IP;

    location / {
        root /home/path/dist;
        index index.html index.htm;
       try_files $uri $uri/ /index.html;
        proxy_pass "http://127.0.0.1:8080";
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_cache_bypass $http_upgrade;

  }
}

試試這個sudo journalctl --follow _SYSTEMD_UNIT=nginx.service並查看當您發出請求時控制台中發生了什么。 您也可以嘗試按照以下步驟設置錯誤日志以進行調試

  1. sudo nano /etc/nginx/nginx.conf
  2. 找到行 error_log
  3. 將錯誤級別更改為 debug logs/error.log debug
  4. sudo service nginx restart

.

嘗試刪除以 server_name 開頭的行

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM