Nginx的配置

  • 在/usr/local/nginx/conf目录下nginx.conf文件是nginx的配置文件。

Html在nginx里

  • 通过端口区分虚拟机

    • 在nginx.conf文件中添加一个Service节点,修改端口号就可以

      server {
      listen 81;
      server_name localhost;
      #charset koi8-r;
      #access_log logs/host.access.log main;
      location / {
      root html81;
      index index.html index.htm;
      }
      }

  • 通过域名区分虚拟机

可以通过修改host文件指定域名的ip地址。
Host文件的位置:C:\Windows\System32\drivers\etc
可以使用工具:

需要修改nginx.conf配置文件。

server {
listen 80;
server_name ithelei.com.cn;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html-test3;
index index.html index.htm;
}
}

修改配置后需要重新加载配置文件。


最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容