Nginx 在启动时不启动

Nginx 在启动时不启动

我是新来的,遇到了一个问题。

我在 Freenas 上使用 Ubuntu 作为虚拟机进行反向代理。我在 Ubuntu 启动时遇到以下错误:

输入以下命令“sudo service nginx status”后,我收到此错误日志:

无法启动高性能 Web 服务器和反向代理服务器。

root@Proxy:~# service nginx configtest 
 * Testing nginx configuration [ OK ]                             

这是我的反向 proxy.conf 的样子:

server {
listen 80;
  server_name freenas.domain.de;
  location / {
     proxy_pass http://freenas.domain.de:80;
  }
}
server {
listen 81;
 server_name nextcloud.domain.de;
  location / {
     proxy_pass http://nextcloud.domain.de:81;
  }
}
server {
listen 82;
  server_name plex.domain.de;
  location / {
     proxy_pass http://plex.domain.de:82;
  }
}

以下是 My Freenas 上服务的 IP 地址

Nextcloud:192.168.178.63:8282 Freenas:192.168.178.63 Plex:192.168.178.22:32400

root@Proxy:~# sudo service nginx status
● nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sat 2020-01-11 03:49:24 CET; 58min left
     Docs: man:nginx(8)
  Process: 732 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)

Jan 11 03:49:23 Proxy systemd[1]: Starting A high performance web server and a reverse proxy server...
Jan 11 03:49:24 Proxy nginx[732]: nginx: [emerg] host not found in upstream "freenas.domain.de" in /etc/nginx/sites-enabled/reverse-proxy.conf:5
Jan 11 03:49:24 Proxy nginx[732]: nginx: configuration file /etc/nginx/nginx.conf test failed
Jan 11 03:49:24 Proxy systemd[1]: nginx.service: Control process exited, code=exited status=1
Jan 11 03:49:24 Proxy systemd[1]: nginx.service: Failed with result 'exit-code'.
Jan 11 03:49:24 Proxy systemd[1]: Failed to start A high performance web server and a reverse proxy server.

谁能帮我?

答案1

host not found in upstream "freenas.domain.de"看起来非常具体。

你能ping freenas.domain.de吗?我无法通过浏览器访问。

如果freenas.domain.de存在,你需要找到 IP 并将其输入/etc/hosts

相关内容