หน้าเว็บ

About me

Hi, I'm cheer. My interest relates to artificial intelligence, machine learning, computer vision, network communication, security algorithm.

วันอาทิตย์ที่ 5 กันยายน พ.ศ. 2553

Virtual Host on Apache2 [Ubuntu Lucid]

  1. gedit /etc/apache2/apache2.conf

    ServerRoot "/etc/apache2"
    ServerName ... --> whatever you like eg. ServerName CzEmpire

  2. Set Apache's ports > gedit /etc/apache2/ports.conf

    #Listen for virtual host request on all IP addresses at port 80
    NameVirtualHost *

    #Listen on port 80
    Listen 80

  3. Create virtual host
    > cd sites-available

    #Create first virtual host named "localhost" eg. http://localhost
    > gedit localhost



    #Specify where "localhost" directory locates
    DocumentRoot /var/www/localhost

    #Specify name for this virtual host
    ServerName localhost
    ServerAdmin xxx@xxx.xxx



  4. Enable virtual host configuration
    > a2ensite localhost
    > a2ensite www.abc.com

  5. Create web site repository
    > cd /var/www
    > mkdir localhost/htdocs
    > mkdir localhost/logs
    > mkdir localhost/cgi-bin

    > mkdir www.abc.com/htdocs
    > mkdir www.abc.com/logs
    > mkdir www.abc.com/cgi-bin

  6. Make your server know all previous domain names
    > gedit /etc/hosts

    127.0.0.1 localhost www.abc.com

  7. Restart system
  8. Start Apache2 engine
    > /etc/init.d/apache2 start