drzrzzkh462254 2017-04-17 01:27
浏览 22
已采纳

在一个域名上配置两个symfony实例

I have a development server where I have hosted a site which is build on symfony framework (www.example.com) Now for this domain name "www.example.com", we have all SSL certificates and other things required for the website.

I have a requirement where I have to deploy one more symfony instance but without creating a new domain name. How can I achieve it? Can it point to www.example.com/newInstance ?

Can I run two websites on a same domain name? www.example.com/oldInstance and www.example.com/newInstance

I have less knowledge about networking, so looking for help on this one.

  • 写回答

2条回答 默认 最新

  • doujiao1949 2017-04-17 01:53
    关注

    If you are using Apache as web server you can use alias to point each directory

    <VirtualHost *:80>
      DocumentRoot "path/To/Your/DocumentRoot/oldInstance"
      ServerName www.example.com
    
      <Directory "path/To/Your/DocumentRoot/oldInstance">
        DirectoryIndex app.php
        Options Indexes    
        AllowOverride All
        Require all granted
      </Directory>
    
       Alias /newInstance "path/To/Your/DocumentRoot/newInstance"
    
       <Directory "path/To/Your/DocumentRoot/newInstance">
          DirectoryIndex app.php
          Options Indexes
          AllowOverride All
          Require all granted
      </Directory>  
    </VirtualHost>
    

    If you request http://example.com/ you will get oldInstance directory. If you request http://example.com/newInstance you will get newInstance directory.

    If you want get oldInstance directory by using http://example.com/oldInstance instead of http://example.com then you can configure another alias for that:

    Alias /oldInstance "path/To/Your/DocumentRoot/oldInstance"
    

    Remember to check if mod_alias is enabled in your Apache config.

    LoadModule alias_module modules/mod_alias.so
    

    I hope it helps you.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部