虚拟服务器上有多个主机名

虚拟服务器上有多个主机名

我使用了两个 nginx 文件 - 一个用于 vue 前端,一个用于 nginx 后端(proxy_pass)。

/etc/hosts我在 nginx vue 配置中使用的 当前指定主机名。例如:server_name inf-education-67.umwelt-campus.de;

在 nginx 节点配置中使用 localhost 时,我从系统外访问它时不断收到错误。因此,我需要在 vServer 上使用另一个主机名。也用于对后端进行 Axios 调用。例如server_name inf-education-backend.umwelt-campus.de

我该怎么做?(我真的不熟悉这些东西)

这是正确的方法吗?

主机文件是:

127.0.0.1 localhost
127.0.1.1 inf-education-67 #The current host name

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

使用 Ubuntu 20.04

相关内容