嗨,我在我的本地机器上有与ReactPHP一起工作的REST Api,我想把它部署在一个dev服务器上,
我在DO上添加了一个新的子域,使用nginx放置了一个conf,并为ReactPHP应用程序设置了一个正在进行的进程来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>我的nginx conf
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
}发布于 2020-02-27 09:39:55
经过一些错误和试验使它起作用
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}
几点
H 110502坏网关{这是因为我的服务器当时没有运行}H 211F 212
https://stackoverflow.com/questions/60115197
复制相似问题