1.修改nginx安装目录下\conf\nginx.conf,修改server内容

nginx配置虚拟主机

2.重新加载

nginx配置虚拟主机

3.访问localhost,出现了403 Forbidden,是因为路径写错了

nginx配置虚拟主机

4.可以设置通过域名访问网站页面

C:\Windows\System32\drivers\etc下hosts文件中,

nginx配置虚拟主机

可将localhost改为网址,

nginx配置虚拟主机

 

相关文章:

  • 2021-05-28
  • 2022-02-15
  • 2022-02-04
猜你喜欢
  • 2021-05-11
  • 2021-09-09
  • 2021-10-07
  • 2021-10-23
  • 2021-07-29
  • 2021-07-27
相关资源
相似解决方案