我的NuxtJs部署出现问题。我正在尝试使用DigitalOcean Droplet和nginx进行此操作。我正在将Nginx与反向代理搭配以下配置使用。
server {
listen 80; # the port nginx is listening on
server_name reepen.gg; # setup your domain here
gzip on;
gzip_types text/plain application/xml text/css application/javascript;
gzip_min_length 1000;
, location / {
expires $expires;
proxy_redirect off;
proxy_set_header Host $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_read_timeout 1m;
proxy_connect_timeout 1m;
proxy_pass http://localhost:3000; # set the address of the Node.js instance here
}
}
[当我尝试curl http://localhost:80
时,响应是Nuxt应用程序的索引html代码。但是,当我尝试用他的IP地址或域名在我的Droplet外部呼叫时,我已经ERR_CONNECTION_TIMED_OUT
。我不知道为什么我的Droplet IP地址未与我的http://localhost:80
为了配置我的Droplet,我使用了本教程(我已在doc中设置防火墙)https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-18-04
而且我已经尝试过本教程来部署我的应用https://medium.com/codeartisan/how-to-run-nuxt-js-on-digitalocean-159fc558d2ab
感谢您的帮助:)
这是我在https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-18-04中设置的ufw防火墙>
当我禁用它时,一切正常!