Virtual host on ubuntu 13.10 and apache 2.4.6

前端 未结 8 1458
迷失自我
迷失自我 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:44

    I had a same issue ,but None of these above postings worked for me . Later I read and reviewed each and every configuration files of Apache and PHP .

    I could figure out that in apache2.conf( in ubuntu 13.10 ) there is a flag called

    HostnameLookups off
    

    By Default this will be set to off, I changed this to

    HostnameLookups on
    

    By doing so Apache started piking up my host entries and vhost config well .

    Also Below is my actual Vhost file . which I used to make it working

    Offcourse I too recommend adding Require all granted with in the Vhost directive .

    <VirtualHost *:80>
        ServerName test.yoursite.domain.in
        DocumentRoot path_to_code_base/public
        <Directory path_to_code_base/public>
            Options -Indexes
            Require all granted
            DirectoryIndex index.php
            AllowOverride All
        </Directory>
        ErrorLog  /path_to_code_base/logs/error.log
        LogLevel warn
        CustomLog /path_to_code_base/logs/access.log  combined
    </VirtualHost> 
    

    I am posting this to help others who does not want to waste there time in downgrading Ubuntu to 13.04 from 13.10 .

    I do-not see this any blogs , I also could not understand what actually the meaning of hostnameLookups is .

    Hope this helps .

    0 讨论(0)
  • 2021-01-30 07:47

    Execute:
    vim can be change with your favourite text editor like nano, pico and etc.

    vim /etc/apache2/apache2.conf

    Original file:

    # Sets the default security model of the Apache2 HTTPD server. It does
    # not allow access to the root filesystem outside of /usr/share and /var/www.
    # The former is used by web applications packaged in Debian,
    # the latter may be used for local directories served by the web server. If
    # your system is serving content from a sub-directory in /srv you must allow
    # access here, or in any related virtual host.
    <Directory />
            Options FollowSymLinks
            AllowOverride None
            Require all denied
    </Directory>
    
    <Directory /usr/share/>
            AllowOverride None
            Require all granted
    </Directory>
    
    <Directory /var/www/>
            Options Indexes FollowSymLinks
            AllowOverride None
            Require all granted
    </Directory>
    

    Change None to All

    Edit file:

    # Sets the default security model of the Apache2 HTTPD server. It does
    # not allow access to the root filesystem outside of /usr/share and /var/www.
    # The former is used by web applications packaged in Debian,
    # the latter may be used for local directories served by the web server. If
    # your system is serving content from a sub-directory in /srv you must allow
    # access here, or in any related virtual host.
    <Directory />
            Options FollowSymLinks
            AllowOverride All
            Require all denied
    </Directory>
    
    <Directory /usr/share/>
            AllowOverride All
            Require all granted
    </Directory>
    
    <Directory /var/www/>
            Options Indexes FollowSymLinks
            AllowOverride All
            Require all granted
    </Directory>
    
    0 讨论(0)
提交回复
热议问题