页面仅在某些计算机上加载

时间:2015-03-25 20:28:09

标签: apache nginx debian

从现在开始,我只将我的服务器用于教育目的和编码视频。现在我想尝试使用nginx和apache来托管一些网站(对我的朋友),但问题是,即使它成功加载到我的计算机上,还有其他一些网站,我也看到该页面没有加载而不是它只显示“欢迎使用debian nginx”页面。 我怎样才能让它每次都有效?

/etc/nginx/sites-available/uterfleru.cz:

server {
  listen          80;

  root /var/uterfleru.cz;
  index index.html index.php index.htm;

  server_name uterfleru.cz;
}

DNS - 答:

uterfleru.cz    64.188.46.67
www.uterfleru.cz    64.188.46.67 

64.188.46.67是我服务器的ipv4, http://uterfleru.cz/是网页。

1 个答案:

答案 0 :(得分:1)

server_name uterfleru.cz;表示uterfleru.cz域名。要使此server块适用于www子域,您必须对其进行修改like that

server_name www.uterfleru.cz uterfleru.cz;

要使其适用于任何子域,您必须将其更改为:

# synonym of *.uterfleru.cz uterfleru.cz;
server_name .uterfleru.cz;

要使此服务器块默认工作,您必须删除/etc/nginx/sites-enabled/default.conf文件并修改listen指令like that

listen 80 default;

Official documentation拥有您需要的所有信息,这是我见过的最好的软件文档之一,我强烈建议您学会使用它。