我正在尝试使用nginx运行Akka服务。这是我的default.conf:
upstream hello-akka{
server localhost:9000;
}
server {
listen 9000;
location /* {
root /usr/share/nginx/html;
index index.html index.htm;
}
location /akka {
proxy_pass http://hello-akka;
}
location /assets {
root /var/www;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
默认的nginx页面工作得很好但是当我重定向到/ akka时,我得到 500内部服务器错误。这是我的nginx日志文件:
2017/12/05 10:58:17 [crit] 11077#11077: *1014 open() "/usr/share/nginx/html/50x.html" failed (24: Too many open files), client: 127.0.0.1, server: , request: "GET /akka HTTP/1.0", upstream: "http://127.0.0.1:9000/akka", host: "hello-akka"
我更改了/etc/security/limits.con文件,将连接数从1024增加到16384.然而,之后我又收到了另一个错误:
host: "hello-akka"
2017/12/05 11:40:42 [error] 15916#15916: *37494 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 127.0.0.1, server: , request: "GET /akka HTTP/1.0", upstream: "http://127.0.0.1:9000/akka"
那么我的配置有什么问题?如何将它们更改为正常运行/ akka页面?
更新:我在上游hello-akka中将server localhost:9000
更改为server localhost:8080
。但是,当我重定向到localhost:9000 / akka时,我得到发生错误页面。
错误日志显示此错误:
*1 connect() failed (111: Connection refused) while connecting to upstream, client: 127.0.0.1, server: , request: "GET /akka HTTP/1.1", upstream: "http://127.0.0.1:8080/akka", host: "localhost:9000"