在乌布努图 18.04 上部署

我已经在我的本地计算机上使用ReactPHP工作REST API,我想将其部署在开发服务器上,


我在DO上添加了一个新闻数据库域,与nginx进行了讨论,设置了一个正在进行的php索引进程.php我的服务器根文件为ReactPHP应用程序。


已允许端口 8000。


现在我无法访问我的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

}


人到中年有点甜
浏览 80回答 1
1回答

慕桂英3389331

经过一些错误和试验后,它的工作原理server {&nbsp;listen 80;server_name test.example.com;&nbsp;location / {&nbsp; &nbsp; proxy_pass&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;http://127.0.0.1:8000;&nbsp; &nbsp; proxy_set_header Host&nbsp; $host;&nbsp; &nbsp; proxy_read_timeout&nbsp; &nbsp; &nbsp;60;&nbsp; &nbsp; proxy_connect_timeout&nbsp; 60;&nbsp; &nbsp; proxy_redirect&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;off;&nbsp; &nbsp; # Allow the use of websockets&nbsp; &nbsp; proxy_http_version 1.1;&nbsp; &nbsp; proxy_set_header Upgrade $http_upgrade;&nbsp; &nbsp; proxy_set_header Connection 'upgrade';&nbsp; &nbsp; proxy_set_header Host $host;&nbsp; &nbsp; proxy_cache_bypass $http_upgrade;}&nbsp;location /favicon.ico { alias /path/to/favicon.ico; }listen 443 ssl http2;&nbsp;#ssl info removed}一些要点从服务器中删除根目录删除索引 {我们不需要索引,因为 ReactPhp 有自己的服务器}将proxy_pass端口与 ReactPhp 服务器端口匹配最好通过代理提供 SSL 与 nginx { 作为反应应用程序文档}502 网关错误 { 发生这种情况是因为我的服务器当时没有运行}
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript