我在MVC Core上创建了一个网站,并试图在CentOS 7 VPS上将其发布到网上.它运行良好,当我卷曲它响应.然后我安装了Nginx并在我的计算机上尝试时显示了默认页面.然后我将Nginx.conf更改为下面的一个,我得到的是502坏网关.在Nginx日志中,我只看到收到了get请求.任何想法我应该检查什么?
user Nginx;
worker_processes auto;
error_log /var/log/Nginx/error.log;
pid /run/Nginx.pid;
# Load dynamic modules. See /usr/share/Nginx/README.dynamic.
include /usr/share/Nginx/modules/*.conf;
events {
worker_connections 1024;
}
http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/Nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/Nginx/mime.types;
default_type application/octet-stream;
# Load modular configuration files from the /etc/Nginx/conf.d directory.
# See http://Nginx.org/en/docs/ngx_core_module.html#include
# for more @R_952_4045@ion.
# include /etc/Nginx/conf.d/*.conf;
server {
listen 80;
location / {
proxy_pass http://localhost:5000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection keep-alive;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
}
最佳答案:
我试过apache并遇到了同样的问题.然后我找到了解决方案,你必须设置httpd_can_network_connect.
http://sysadminsjourney.com/content/2010/02/01/apache-modproxy-error-13permission-denied-error-rhel/
A没有在审核博客中找到作者正在谈论的错误消息,但我尝试了他的解决方案并且它有效.
我现在已经使用了centos 4天了,这是我第二次设置一点来解决问题.这些解决方案非常隐藏在网络中,大多数涉及该领域的文章都没有提到这些,所以我失去了很多时间.所以我赞同作者对SELinux的看法.可能我会尝试另一个Linux发行版.
有趣的是,我遵循官方的微软教程“使用Apache在Linux上为ASP.NET Core设置托管环境,并部署到它”.他们使用的操作系统也是CentOS.它也没有提到这一点.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。