如何解决Nginx服务器无法用于远程访问
所以我要使用Nginx,docker和docker compose在虚拟机上部署Web应用程序。但是,我只能从vm的托管计算机访问我的网站。搜索后,我认为我的Nginx.conf可能不对。感谢您的帮助!
events { }
http {
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
# redirect www -> non-www
server {
server_name www.network.cloudMetabolomics.ca;
return 301 $scheme://network.cloudMetabolomics.ca$request_uri;
}
# redirect http -> https
server {
listen 80;
server_name network.cloudMetabolomics.ca;
return 301 https://network.cloudMetabolomics.ca$request_uri;
}
# read the ssl certificate / key when listening on https
server {
listen 443 ssl;
server_name network.cloudMetabolomics.ca;
ssl_certificate /etc/Nginx/certs/fullchain.pem;
ssl_certificate_key /etc/Nginx/certs/privkey.pem;
access_log /var/log/Nginx/data-access.log combined;
# serve the static files
location / {
root /usr/share/Nginx/html;
}
location /api {
proxy_pass http://backend:5000/api;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_redirect http://backend:5000/api $scheme://$http_host/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_read_timeout 20d;
proxy_buffering off;
}
}
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。