Different VirtualHosts with the same port

前端 未结 2 1784
误落风尘
误落风尘 2020-12-14 18:12

I need to have two VirtualHosts with the same listen port for different projects and with different logs. Here\'s what I\'ve got:


           


        
2条回答
  •  死守一世寂寞
    2020-12-14 18:55

    Add different ServerName directive in all virtual hosts:

    
            ServerName dev.localhost
            DocumentRoot /home/projects/smk/cms
            ErrorLog /var/log/apache2/smk-cms-error.log
    
    
    
            ServerName my-project.localhost
            DocumentRoot /home/projects/smk/deploy
            ErrorLog /var/log/apache2/smk-deploy-error.log
    
    

    Don't forget to add host-entries for dev.localhost and my-project.localhost in /etc/hosts to 127.0.0.1 or whatever ip you want it to point to.

提交回复
热议问题