亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

在烏布努圖 18.04 上部署

在烏布努圖 18.04 上部署

人到中年有點甜 2022-09-12 11:00:41
我已經在我的本地計算機上使用ReactPHP工作REST API,我想將其部署在開發服務器上,我在DO上添加了一個新聞數據庫域,與nginx進行了討論,設置了一個正在進行的php索引進程.php我的服務器根文件為ReactPHP應用程序。已允許端口 8000?,F在我無法訪問我的api路由我的服務器日志顯示為默認回顯Listening on tls://127.0.0.1:8000$loop->run();在擊中子域的路線上,它說<html><head>    <title>502 Bad Gateway</title></head><body bgcolor="white">    <center>        <h1>502 Bad Gateway</h1>    </center>    <hr>    <center>nginx/1.14.0 (Ubuntu)</center></body></html>我的恩金克斯會議server {     listen 80;    server_name test.example.com;    root /var/www/api;     index index.php index.html index.htm index.nginx-debian.html;    location / {        proxy_pass             http://127.0.0.1:8000;        proxy_set_header Host  $host;        proxy_read_timeout     60;        proxy_connect_timeout  60;        proxy_redirect         off;        # Allow the use of websockets        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;    }     listen 443 ssl http2;     #ssl info removed}
查看完整描述

1 回答

?
慕桂英3389331

TA貢獻2036條經驗 獲得超8個贊

經過一些錯誤和試驗后,它的工作原理


server { 

listen 80;

server_name test.example.com; 


location / {

    proxy_pass             http://127.0.0.1:8000;

    proxy_set_header Host  $host;

    proxy_read_timeout     60;

    proxy_connect_timeout  60;

    proxy_redirect         off;


    # Allow the use of websockets

    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;


location /favicon.ico { alias /path/to/favicon.ico; }


listen 443 ssl http2; 

#ssl info removed

}

一些要點

  • 從服務器中刪除根目錄

  • 刪除索引 {我們不需要索引,因為 ReactPhp 有自己的服務器}

  • 將proxy_pass端口與 ReactPhp 服務器端口匹配

  • 最好通過代理提供 SSL 與 nginx { 作為反應應用程序文檔}

  • 502 網關錯誤 { 發生這種情況是因為我的服務器當時沒有運行}


查看完整回答
反對 回復 2022-09-12
  • 1 回答
  • 0 關注
  • 74 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號