一台机子部署多个网站,我们直接访问ip (外网内网都一样)提示无法访问或404.

因为有多个网站,我们想指定某个网站为IP访问默认的网站,如何操作呢?

 

解:在Listen ip:port; 这个指令行中,加参数default

这个server段就会是这个ip的默认站点

server {
        listen       80 default;
        server_name  web.com ;
        location / {
            root   F:/project/web;
            index  index.html index.htm index.php;
            autoindex  on;
        }
        location ~ \.php$ {
            root          F:/project/web;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }
}

 

相关文章:

  • 2021-11-27
  • 2022-12-23
  • 2021-11-01
  • 2022-02-07
  • 2022-03-05
  • 2021-09-27
  • 2021-08-21
猜你喜欢
  • 2021-08-10
  • 2021-10-23
  • 2021-07-12
  • 2021-09-07
  • 2022-12-23
  • 2022-12-23
  • 2022-02-22
相关资源
相似解决方案