我尝试在我的 VPS 上运行 STRAPI CMS。
应用程序通过 PM2 运行,内部 curl 正常,我看到应用程序的响应
curl -v http://127.0.0.1:1337
但外部 curl 是个问题,现在我只想通过http://89.221.222.178:8090(仅用于切换到“域模式”之前的测试)。
curl -v http://89.221.222.178:8090
* Rebuilt URL to: http://89.221.222.178:8090/re (v6)
* Trying 89.221.222.178...LLOW Anywhere (v6)
* TCP_NODELAY set ALLOW Anywhere (v6)
* connect to 89.221.222.178 port 8090 failed: Connection refused
* Failed to connect to 89.221.222.178 port 8090: Connection refused
* Closing connection 0
curl: (7) Failed to connect to 89.221.222.178 port 8090: Connection refusedata.poutnicesty.cz
防火墙允许端口
...
sudo ufw status
8090 ALLOW Anywhere
8090/tcp ALLOW Anywhere
8090/tcp (v6) ALLOW Anywhere (v6)
...
Nginx 配置:
server {
listen 8090;
listen [::]:8090;
root /var/www/data.poutnicesty.cz/;
index index.html index.htm index.nginx-debian.html;
server_name 89.221.222.178:8090;
gzip on;
gzip_types text/plain application/xml text/css application/javascript;
gzip_min_length 1000;
access_log /var/log/nginx/data.poutnicesty.cz.access.log;
error_log /var/log/nginx/data.poutnicesty.cz.error.log;
port_in_redirect off;
proxy_set_header Host $host:$server_port;
location / {
proxy_pass http://127.0.0.1:1337;
proxy_http_version 1.1;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_pass_request_headers on;
}
}
我认为仅允许端口就足够了(对于其他“子域”,它可以工作,例如:端口:8050 - 但我在那里使用 nuxt 应用程序进行了测试,而不是 strapi)。
任何想法?
多谢。