brikhoff
V2EX  ›  问与答

nginx 本地怎么配置多项目的访问?

  •  
  •   brikhoff · Oct 25, 2013 · 9972 views
    This topic created in 4771 days ago, the information mentioned may be changed or developed.
    vhost 怎么配置才能让多个项目都能访问。现在localhost绑定了一个项目,那么其他的该怎么配置才可以访问?
    Supplement 1  ·  Oct 25, 2013
    已解决
    9 replies  •  1970-01-01 08:00:00 +08:00
    manhere
    manhere
    Oct 25, 2013
    1
    127.0.0.1
    127.0.0.2
    127.0.0.3
    brikhoff
    brikhoff
    OP
    Oct 25, 2013
    2
    @manhere 具体怎么操作,只有一个ip噻,我怎么给他绑定多个ip?
    tinypig
    tinypig
    Oct 25, 2013❤️1
    3
    可以根据不同的端口配置,也可以根据不同的server_name
    可以参考官方文档
    http://nginx.org/cn/docs/
    cooper
    cooper
    Oct 25, 2013
    4
    我的博客,希望帮到你。http://www.lapland.name/post/60755589823
    young
    young
    Oct 25, 2013
    5
    我是将每个项目都放localhost下, 再针对每个项目搞个location
    duhastmich
    duhastmich
    Oct 25, 2013
    6
    本地就别用nginx了,一般都自带服务器的
    msg7086
    msg7086
    Oct 25, 2013❤️1
    7
    如果在虚拟机上跑的话可以在网卡上绑多个ip。如果单机的话还是考虑配多端口吧。
    brikhoff
    brikhoff
    OP
    Oct 25, 2013
    8
    @duhastmich 主要是想和生产环境一样
    ipconfiger
    ipconfiger
    Oct 25, 2013
    9
    vhost用域名不用IP,然后在/etc/hosts添加本地映射 windows下在system32/drivers/etc/hosts
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1164 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 17:50 · PVG 01:50 · LAX 09:50 · JFK 12:50
    ♥ Do have faith in what you're doing.