brikhoff
V2EX  ›  问与答

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

  •  
  •   brikhoff · Oct 25, 2013 · 9606 views
    This topic created in 4608 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
        1
    manhere  
       Oct 25, 2013
    127.0.0.1
    127.0.0.2
    127.0.0.3
    brikhoff
        2
    brikhoff  
    OP
       Oct 25, 2013
    @manhere 具体怎么操作,只有一个ip噻,我怎么给他绑定多个ip?
    tinypig
        3
    tinypig  
       Oct 25, 2013   ❤️ 1
    可以根据不同的端口配置,也可以根据不同的server_name
    可以参考官方文档
    http://nginx.org/cn/docs/
    cooper
        4
    cooper  
       Oct 25, 2013
    我的博客,希望帮到你。http://www.lapland.name/post/60755589823
    young
        5
    young  
       Oct 25, 2013
    我是将每个项目都放localhost下, 再针对每个项目搞个location
    duhastmich
        6
    duhastmich  
       Oct 25, 2013
    本地就别用nginx了,一般都自带服务器的
    msg7086
        7
    msg7086  
       Oct 25, 2013   ❤️ 1
    如果在虚拟机上跑的话可以在网卡上绑多个ip。如果单机的话还是考虑配多端口吧。
    brikhoff
        8
    brikhoff  
    OP
       Oct 25, 2013
    @duhastmich 主要是想和生产环境一样
    ipconfiger
        9
    ipconfiger  
       Oct 25, 2013
    vhost用域名不用IP,然后在/etc/hosts添加本地映射 windows下在system32/drivers/etc/hosts
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2743 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 43ms · UTC 11:36 · PVG 19:36 · LAX 04:36 · JFK 07:36
    ♥ Do have faith in what you're doing.