Virtual host na ubuntu 13.10 i apache 2.4.6

Mam następujący problem
Mój plik hosts wygląda następująco:

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

Mój plik w {[4] } wygląda następująco:

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        ServerName mysite.localhost

        DocumentRoot /var/www/mysite

        <Directory /var/www/mysite/>
                Options Indexes FollowSymLinks
                AllowOverride All
                Require all granted
        </Directory>
        ErrorLog /var/log/apache2/mysite-error.log
        CustomLog /var/log/apache2/mysite-access.log common
</VirtualHost>

Po wykonaniu sudo a2ensite mysite.localhost.conf i ponownym uruchomieniu apache na mysite.localhost / i tylko na localhost dostaję następujące (jak wypisanie katalogu bez pliku indeksu w nim):

Index of /

[ICO]   Name    Last modified   Size    Description
[DIR]   apache_logs/    2013-09-24 10:15     -   
[DIR]   mysql/  2013-10-22 10:05     -   
[DIR]   tools/  2013-10-22 10:05

I w każdym innym folderze w katalogu /var/www/ np. test gdy wpiszę localhost/test zamiast wczytać plik index.php wyświetla się:

Not Found

The requested URL /adlantic was not found on this server.

Apache/2.4.6 (Ubuntu) Server at localhost Port 80   

If I do sudo a2dissite mysite.conf and restart apache wszystko ładuje się ok. Chyba problem jest gdzieś w mysite.localhost.conf, ale nie mogę znaleźć gdzie. Jakieś pomysły? 10x

Author: Paulo Coghi, 2013-10-22

8 answers

Ubuntu 13.10 i warianty zostały przeniesione na Apache 2.4. Apache 2.4 chce włączyć pliki konfiguracyjne wirtualnego hosta, aby zakończyć.domyślnie conf.

Rozwiązanie

Teraz, aby rozwiązać ten problem, są dwie metody, których możesz użyć, aby osiągnąć ten sam wynik.

  1. Pierwszym rozwiązaniem i prostym rozwiązaniem jest dodanierozszerzenie conf do wszystkich Twoich wirtualnych hostów. Nowy Apache 2.4 odczytuje każdy wirtualny host w katalogu stron dostępnych z.rozszerzenie conf nowy plik konfiguracyjny Apache 2.4.

  2. Drugim rozwiązaniem jest usunięcie .zapraszamy do zapoznania się z naszą ofertą.conf

W starym pliku Apache 2.2 .plik conf miał włączoną opcję Include sites / podczas gdy nowy .plik conf ma

# Include the virtual host configurations:
IncludeOptional sites-enabled/*.conf

Zmień tę linijkę na:

# Include the virtual host configurations:
IncludeOptional sites-enabled/

Wyniki: polecenie a2ensite yourdomain działa teraz zgodnie z oczekiwaniami. Jeśli używasz drugiej metody; Twoje wirtualne pliki hosta nie nie trzeba .rozszerzenie conf.

Note: Configuration file is "/etc/apache2/apache2.conf" in new Apache, so please copy document root path and other configurations from "/etc/apache2/sites-available/000-default.conf" to  "/etc/apache2/apache2.conf"
 55
Author: Anjith K P,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2014-04-22 12:42:21

Problem znalazłem po 3h eksperymentów. Najwyraźniej w Nowym Ubuntu 13.10 z jakiegoś głupiego powodu plik conf dla wirtualnego hosta musi wyglądać podobnie do tego:

<VirtualHost mysite.localhost>
        ServerAdmin [email protected]
        ServerName  mysite.localhost
        ServerAlias mysite.localhost

        # Indexes + Directory Root.
        DocumentRoot /var/www/mysite/public_html

         <Directory /var/www/mysite/public_html/>
                DirectoryIndex index.php
                Options Indexes FollowSymLinks
                AllowOverride All
                Require all granted
        </Directory>

        # Logfiles
        ErrorLog /var/log/apache2/mysite-error.log
        CustomLog /var/log/apache2/mysite-access.log common
</VirtualHost>

Najwyraźniej ludzie, którzy opracowali Ubuntu 13.10, uznali, że nie jest już wartościowy w użyciu

<VirtualHost *:80> 

Podczas tworzenia wirtualnego hosta i zamiast tego musi być

<VirtualHost mysite.localhost>

Zmieszane ze specyficznym określeniem DirectoryIndex. To naprawiło problem, który miałem i teraz wszystko działa(Mam nadzieję, że jako powinni, coś może w końcu wyskoczyć) najwyraźniej plik konfiguracyjny apache ' a jest inny.

 13
Author: Lachezar Raychev,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2014-04-22 14:19:11

Miałem ten sam problem, ale żaden z powyższych postów Nie działał dla mnie . Później przeczytałem i przejrzałem każdy plik konfiguracyjny Apache i PHP .

W tym roku mamy już ponad 100 000 klientów z całego świata.conf (w ubuntu 13.10) jest flaga o nazwie
HostnameLookups off

Domyślnie będzie to ustawione na off, zmieniłem to na

HostnameLookups on

W ten sposób Apache zaczął dobrze przeglądać wpisy mojego hosta i konfigurację vhost .

Również poniżej znajduje się mój rzeczywisty plik Vhost . które kiedyś robiłam praca

Oczywiście ja również polecam dodanie Require all granted z w dyrektywie Vhost .

<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> 

Zamieszczam to, aby pomóc innym, którzy nie chcą tracić czasu na obniżenie wersji Ubuntu do 13.04 z 13.10 .

Nie widzę tego żadnego bloga, nie mogłem również zrozumieć, co właściwie oznacza hostnameLookups .

Mam nadzieję, że to pomoże .
 4
Author: aravind.udayashankara,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2014-03-07 01:56:52

Dla Apache 2.4.6 w Ubuntu 13.10,

Będziesz miał

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

I

/etc/apache2/sites-enabled/000-default.conf punkty do /etc/apache2/sites-available/000-default.conf

Teraz edytuj apache2.conf i dodaj

<Directory /home/my_site/public_html/>
    #YOUR SETTINGS
</Directory>

I edytuj sites-available/000-default.conf i zmień <VirtualHost *:80> na <VirtualHost localhost:80>, aby apache nasłuchiwał localhost (na porcie 80) dla domyślnych ustawień.

Teraz aby mysite.localhost zadziałało, dodaj to do sites-available/000-default.conf

<VirtualHost mysite.localhost:80>
    ServerName mysite.localhost

    ServerAdmin [email protected]

    DocumentRoot /home/my_new_site_public_html

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Teraz Edytuj swój plik /etc/hosts/ i zmień IP z mysite.localhost z 127.0.1.1 na 127.0.0.1

Teraz odwiedź http://mysite.localhost & http://localhost

:)

 2
Author: Harsh Vakharia,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2013-12-23 12:24:37
<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        ServerName mysite.localhost

        DocumentRoot /var/www/mysite

        <Directory /var/www/mysite/>
                Options Indexes FollowSymLinks
                AllowOverride All
                Require all granted
        </Directory>
        ErrorLog /var/log/apache2/mysite-error.log
        CustomLog /var/log/apache2/mysite-access.log common
</VirtualHost>

W moim przypadku zamieniłem <VirtualHost *:80> na <VirtualHost mysite.localhost:80> po wielu próbach i błędach

Mam nadzieję, że to pomoże.

Pozdrawiam,

 1
Author: Junaid Qadir Shekhanzai,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2014-04-08 06:48:26

Wykonanie:
vim można zmienić za pomocą ulubionego edytora tekstu, takiego jak nano, pico itp.

Zapraszamy do zapoznania się z naszą ofertąconf

Oryginalny plik:

# 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>

Zmień None na All

Edycja pliku:

# 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
Author: user3419164,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2014-03-14 09:26:41

Dla Kubuntu 14.04 & Apache 2.4.7

Po wypróbowaniu powyższych sugestii i wciąż zadawaniu problemów z uprawnieniami," chmod 755 $HOME " zadziałał dla mnie. Nie stosować w systemie wieloosobowym.

 0
Author: Mak,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2014-06-27 05:26:48

Tylko uwaga dla osób wyciągających włosy na ten temat, musisz użyć sudo, aby wszystkie te ustawienia miały miejsce, jeśli używasz instancji AWS.

sudo a2ensite example.com

Pamiętaj, że musisz to zrobić nawet przy ponownym uruchomieniu apache ' a. Jeśli nie widzisz zachodzących zmian, prawdopodobnie jest to winowajca.

sudo service apache2 restart
 0
Author: steve,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2015-02-27 16:02:04