NGINX无法加载站点
我有一个nginx站点在8000端口监听。我让Apache监听端口80 当我尝试加载nginx站点时,此错误显示在日志中:NGINX无法加载站点,nginx,nginx-location,nginx-config,Nginx,Nginx Location,Nginx Config,我有一个nginx站点在8000端口监听。我让Apache监听端口80 当我尝试加载nginx站点时,此错误显示在日志中: 2019/03/27 20:13:06 [alert] 7845#7845: 1024 worker_connections are not enough 2019/03/27 20:13:06 [error] 7845#7845: *17498 recv() failed (104: Connection reset by peer) while reading resp
2019/03/27 20:13:06 [alert] 7845#7845: 1024 worker_connections are not enough
2019/03/27 20:13:06 [error] 7845#7845: *17498 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 127.0.0.1, server: erp.example.com, request: "GET / HTTP/1.0", upstream: "http://127.0.0.1:8000/", host: "erp.example.com"
在浏览器中显示默认的502页,位于“/opt/bench/bench repo/bench/config/templates”文件夹中
这里可能出了什么问题
这是完整的nginx.conf文件:
upstream erpnext-frappe {
server 127.0.0.1:8000 fail_timeout=0;
}
upstream erpnext-socketio-server {
server 127.0.0.1:9000 fail_timeout=0;
}
# setup maps
# server blocks
server {
listen 8000;
server_name
erp.example.com
;
root /opt/bench/erpnext/sites;
add_header X-Frame-Options "SAMEORIGIN";
location /assets {
try_files $uri =404;
}
location ~ ^/protected/(.*) {
internal;
try_files /erp.example.com/$1 =404;
}
location /socket.io {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Frappe-Site-Name erp.example.com;
proxy_set_header Origin $scheme://$http_host;
proxy_set_header Host $host;
proxy_pass http://erpnext-socketio-server;
}
location / {
try_files /erp.example.com/public/$uri @webserver;
}
location @webserver {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Frappe-Site-Name erp.example.com;
proxy_set_header Host $host;
proxy_set_header X-Use-X-Accel-Redirect True;
proxy_read_timeout 120;
proxy_redirect off;
proxy_pass http://erpnext-frappe;
}
# error pages
error_page 502 /502.html;
location /502.html {
root /opt/bench/bench-repo/bench/config/templates;
internal;
}
# optimizations
sendfile on;
keepalive_timeout 15;
client_max_body_size 50m;
client_body_buffer_size 16K;
client_header_buffer_size 1k;
# enable gzip compresion
# based on https://mattstauffer.co/blog/enabling-gzip-on-nginx-servers-including-laravel-forge
gzip on;
gzip_http_version 1.1;
gzip_comp_level 5;
gzip_min_length 256;
gzip_proxied any;
gzip_vary on;
gzip_types
application/atom+xml
application/javascript
application/json
application/rss+xml
application/vnd.ms-fontobject
application/x-font-ttf
application/font-woff
application/x-web-app-manifest+json
application/xhtml+xml
application/xml
font/opentype
image/svg+xml
image/x-icon
text/css
text/plain
text/x-component
;
# text/html is always compressed by HttpGzipModule
}
我将其与虚拟机进行了比较,虚拟机上也安装了此应用程序,并且可以正常工作,这几乎是一样的。区别在于,在另一台机器中,nginx在端口80上侦听,python在端口8000上侦听
感谢您的帮助
编辑:
我已将位置/配置更改为:
location / {
try_files $uri $uri/ =404;
}
也就是说,我删除了代理传递配置,现在nginx尝试加载站点,但错误为“禁止”:
如何在NGINX中解决这个问题?我已经解决了
解决方案是将nginx设置为侦听另一个端口,例如8020。然后我重新启动了服务器
重启后,我检查了python是否开始监听端口8000和端口8020上的nginx
这样就行了。我真的不知道python为什么要监听端口8000,以及如何更改它,但现在已经无关紧要了
问候
Jaime为什么要使用相同的端口8000收听python和nginx?不。。你不明白。另一台电脑是NGINX工作的地方,NGINX在端口80上监听,python在端口8000上监听。NGINX不工作的我的PC在端口80上有Apache侦听,在端口8000上有NGINX侦听。此外,配置文件是由bench安装脚本自动创建的。我只将端口80更改为端口8000。我已编辑了该问题。@jstuardo问题是您的变量太多了-没有人有15分钟的时间来阅读该问题,以了解相同端口上所有不相关的服务器。几乎一样?听起来几乎可以用了,那么,有什么问题吗@cnst我不明白你的意思。你是在问我有什么问题吗?我何时显示错误不清楚吗?
*23053 directory index of "/opt/bench/erpnext/sites/" is forbidden