Virtual host on ubuntu 13.10 and apache 2.4.6

前端 未结 8 1460
迷失自我
迷失自我 2021-01-30 07:09

I have the following problem
My hosts file is as follows:

127.0.0.1       localhost
127.0.1.1       barbala4o-HP-ProBook-4530s
127.0.1.1       mysite.local         


        
8条回答
  •  再見小時候
    2021-01-30 07:24

    For Apache 2.4.6 in Ubuntu 13.10,

    You will have

    /etc/apache2/apache2.conf
    /etc/apache2/sites-available/000-default.conf
    

    And

    /etc/apache2/sites-enabled/000-default.conf points to /etc/apache2/sites-available/000-default.conf

    Now, edit apache2.conf and add

    
        #YOUR SETTINGS
    
    

    and edit sites-available/000-default.conf and change to to make apache listen localhost (on port 80) for your default settings.

    Now to make mysite.localhost work, add this to sites-available/000-default.conf

    
        ServerName mysite.localhost
    
        ServerAdmin webmaster@mysite.localhost
    
        DocumentRoot /home/my_new_site_public_html
    
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
    
    

    Now edit your /etc/hosts/ file and change the IP of mysite.localhost from 127.0.1.1 to 127.0.0.1

    Now visit http://mysite.localhost & http://localhost

    :)

提交回复
热议问题