我正在编写Ubuntu 18,并试图通过NGINX呈现一个HTML页面。在此链接之后,我执行了以下步骤:
sudo mkdir -p /var/www/sample/html创建html目录webui放在上面的html目录下conf创建nginx sudo vi /etc/nginx/sites-available/sample.conf文件sample.conf下面
服务器{听80;听:80;root /var/www/sample/html;索引index.html index.htm index.nginx-debian.html;server_name 123.54.67.235;位置/{包括proxy_params;proxy_http_version 1.1;proxy_buffering off;proxy_set_header升级$http_upgrade;proxy_set_header连接“升级”;proxy_pass http://localhost/webui/;} /app {包括proxy_params;proxy_http_version 1.1;proxy_buffering off;proxy_set_header升级$http_upgrade;proxy_set_header连接“升级”;proxy_pass http://123.54.67.235:7000;}
}sudo ln -s /etc/nginx/sites-available/sample.conf /etc/nginx/sites-enabled/创建从它到启用站点目录的链接。server_names_hash_bucket_size 64;sudo nginx -t。收到以下消息:
nginx:配置文件/etc/nginx/nginx.conf语法确定为nginx:配置文件/etc/nginx/nginx.conf测试成功sudo systemctl restart nginx。没有出现错误。现在,当我尝试从浏览器转到http://123.54.67.235时,我得到了nginx 500 Internal Server Error。
不知道我犯了什么错误,因为我对这件事很陌生,也很有经验。有人能说出原因吗?
UPDATE:当我进入Nginx日志时,我会看到下面的Error:
2019/05/05 05:52:51 [alert] 29779#29779: *2588 768 worker_connections are not enough while connecting to upstream, client: 123.54.67.235, server: 134.209.113.22, request: "GET /webui/webui/webui/webui/webui/webui/webui/webui/.....注意:我在conf文件的server_name 字段中使用服务器的ip地址,因为我没有为服务器分配域名.。
发布于 2019-05-05 16:24:49
proxy_pass http://localhost/webui/;语句指向同一服务器,并通过添加无限数量的/webui/路径元素生成递归循环。proxy_pass指令用于反向代理,并用于将请求转发到其他服务器。
要提供静态内容,应该使用root语句。
如果URI /foo应该在/var/www/sample/html/webui/foo上提供文件,则使用root /var/www/sample/html/webui;。
例如:
server {
...
root /var/www/sample/html/webui;
...
location / { }
location /app {
include proxy_params;
proxy_...;
proxy_pass ...;
}
}location /块是空的。
https://stackoverflow.com/questions/55988706
复制相似问题