如何在nginx中连接服务器名称和我的IP
How to connect server name and my IP in nginx
我想通过 nginx.So 创建一个简单的静态 html 页面...我编写 html 和所有 .conf 文件。如果我在 Mozilla 中写下 0.0.0.0 或 127.0.0.1 没关系,并且 worked.But 我无法通过服务器名称或 IP 访问我的 html 页面(我通过 icanhazip.com 获取 IP)。我的错误在哪里?我应该在哪里连接我的 IP 和服务器名称?
P.S。使用常见的 nginx.conf
如果我在 etc/hosts 中写入 IP 和服务器名称之间的连接并使用 "sudo ifconfig enp0s3 (here is my IP)" 除了我的意愿之外没有任何站点 work.And 我也无法通过其他设备进入我的站点
site1.conf
server {
listen 80 ;
root /var/www/html/site1;
# Add index.php to the list if you are using PHP
index index.html index.htm;
server_name www.oleghelp1.com oleghelp1.com;
location / {
try_files $uri $uri/ =404;
}
}
你要做的与nginx无关。问题是您的域名未在外部 DNS 中注册。据推测,您已经拥有该域名。您需要做的下一件事是将您的域名与 Internet 可访问的 IP 地址相关联。这是你DNS Made Easy.
我想通过 nginx.So 创建一个简单的静态 html 页面...我编写 html 和所有 .conf 文件。如果我在 Mozilla 中写下 0.0.0.0 或 127.0.0.1 没关系,并且 worked.But 我无法通过服务器名称或 IP 访问我的 html 页面(我通过 icanhazip.com 获取 IP)。我的错误在哪里?我应该在哪里连接我的 IP 和服务器名称? P.S。使用常见的 nginx.conf
如果我在 etc/hosts 中写入 IP 和服务器名称之间的连接并使用 "sudo ifconfig enp0s3 (here is my IP)" 除了我的意愿之外没有任何站点 work.And 我也无法通过其他设备进入我的站点
site1.conf
server {
listen 80 ;
root /var/www/html/site1;
# Add index.php to the list if you are using PHP
index index.html index.htm;
server_name www.oleghelp1.com oleghelp1.com;
location / {
try_files $uri $uri/ =404;
}
}
你要做的与nginx无关。问题是您的域名未在外部 DNS 中注册。据推测,您已经拥有该域名。您需要做的下一件事是将您的域名与 Internet 可访问的 IP 地址相关联。这是你DNS Made Easy.