2 websites, 2 links

Discussion in 'Apache' started by Teilor111, Apr 11, 2015.

  1. #1
    Hi! Can you help me with configure apache with it, then:
    I have debian (without GUI) server with service: apache2.
    I must make 2 websites.
    First (intex.html) should was avalible on link http:// name1.local/
    secound website (for example website2/secound.html) should was avalible on link http:// name2.local/

    How I can make it?
    I trying make it with virtual hosts, but i searched info and i dont know what exactly i must do.
    In /etc/hosts i have line: 192.168.230.123 name1.local, ok its work for first website,
    but how i must make to enable same secound website?

    Thanks for any help :)
     
    Teilor111, Apr 11, 2015 IP
  2. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #2
    You add another line with the same IP and the name "name2.local" and then you configure your virtualhosts-file to reflect the two different installs / sites.
     
    PoPSiCLe, Apr 11, 2015 IP
  3. Teilor111

    Teilor111 Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #3
    I have this in my httpd-vhosts.conf:

    <VirtualHost *:80>
        ServerAdmin webmaster@localhost
        DocumentRoot "/var/www"
        ServerName name1.local
        ServerAlias name1.local
        ErrorLog "/var/log/apache2/name1.local-error_log"
        CustomLog "/var/log/apache2/name1.local" common
    </VirtualHost>
    
    
    <VirtualHost *:80>
        ServerAdmin webmaster@localhost
        DocumentRoot "/var/www/www2"
        ServerName name2.local
        ErrorLog "/var/log/apache2/name2.local-error_log"
        CustomLog "/var/log/apache2/name2.local-access_log" common
    </VirtualHost>
    Code (markup):
    In /etc/hosts:
    127.0.0.1 name1.local
    127.0.0.1 name2.local


    but it's not worked. How i must make more to enable it?
     
    Teilor111, Apr 12, 2015 IP
  4. Teilor111

    Teilor111 Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #4
    I solve it. Thanks for help.
    I set default site on : a2ensite name.local
    And in this file i set virtual host settings. thanks!
     
    Teilor111, Apr 12, 2015 IP