VirtualHost - nefunkcny scr na javascript
Tu je moj postu co som vsetko vykonal:
Ubuntu -> virtualny pc pomocou VirtualBox -> nastavil som mu pevnu adresu 192.168.1.240 (je pristupny z intranetu)
Nainstaloval som: apache2, php5, mysql-server, libapache2-mod-auth-mysql, php5-mysql, phpmyadmin. Pridal som mod_rewrite (sudo a2enmod rewrite). Nahral som si webstranky do /var/www/webtest/. Javascript mam v zlozke /var/www/webtest/javascript/. Do prehliadaca zadam http://localhost/webtest a vsetko ide ako ma. Vsetko je OK.
Dalej nastavim hosts: 127.0.0.1 localhost webtest (vsetko na tom virtualnom pc).
/etc/apache2/sites-available/default -> skopirujem cely <VirtualHost *:80>...</VirtualHost> a vlozim na koniec a editujem na:
ServerName webtest
DocumentRoot /var/www/webtest
Restart apache2
Upravim cesty v .htaccess na http://webtest/...(z http://localhost/webtest/...) a tiez konstantu, ktoru pouzivam na urcenie cesty tak isto ako .htaccess. Takze cesta k javascriptu je src="http://webtest/javascript/file.js".
Spustim firefox -> http://webtest -> stranka nabehne ale bez src javascriptov. Tie co su definovane v php funguju.
CO JE TREBA ESTE NASTAVIT?? KDE SOM SPRAVIL CHYBU?? PROSIM PORADTE.
Ak zmenim cestu k javascriptu na src="http://192.168.1.240/webtest/javascript/file.js" tak to funguje. Ma sa to definovat takto??? To asi nie?
Pozn. pouzivam absolutne cesty kvoli cool uri (robilo mi to problemy s relativnymi).
Pre pridávanie komentárov sa musíte prihlásiť.
nacitaj ten web a nasledne na to
tail -n 30 /var/log/apache2/error.log
a ten vypis tu pastni
[Fri Jan 14 08:04:47 2011] [error] [client 127.0.0.1] File does not exist: /usr/share/javascript/jquery142.min.js, referer: http://webtest/
[Fri Jan 14 08:04:47 2011] [error] [client 127.0.0.1] File does not exist: /usr/share/javascript/thickbox.js, referer: http://webtest/
[Fri Jan 14 08:04:47 2011] [error] [client 127.0.0.1] File does not exist: /usr/share/javascript/stromove_menu.js, referer: http://webtest/
[Fri Jan 14 08:04:47 2011] [error] [client 127.0.0.1] File does not exist: /usr/share/javascript/jquery142.min.js, referer: http://webtest/
[Fri Jan 14 08:04:47 2011] [error] [client 127.0.0.1] File does not exist: /usr/share/javascript/thickbox.js, referer: http://webtest/
[Fri Jan 14 08:04:47 2011] [error] [client 127.0.0.1] File does not exist: /usr/share/javascript/stromove_menu.js, referer: http://webtest/
[Fri Jan 14 08:06:55 2011] [error] [client 127.0.0.1] File does not exist: /usr/share/javascript/jquery142.min.js, referer: http://webtest/
[Fri Jan 14 08:06:55 2011] [error] [client 127.0.0.1] File does not exist: /usr/share/javascript/thickbox.js, referer: http://webtest/
[Fri Jan 14 08:06:55 2011] [error] [client 127.0.0.1] File does not exist: /usr/share/javascript/stromove_menu.js, referer: http://webtest/
[Fri Jan 14 08:06:55 2011] [error] [client 127.0.0.1] File does not exist: /usr/share/javascript/jquery142.min.js, referer: http://webtest/
[Fri Jan 14 08:06:55 2011] [error] [client 127.0.0.1] File does not exist: /usr/share/javascript/thickbox.js, referer: http://webtest/
[Fri Jan 14 08:06:55 2011] [error] [client 127.0.0.1] File does not exist: /usr/share/javascript/stromove_menu.js, referer: http://webtest/
Preco to hlada /usr/share/ web je ulozeny v /var/www/webtest/ ???
/javascript/file.js
pre vsetkych s tymto problemom. Riesenie je tu:
http://www.warforum.cz/viewtopic.php?t=1156932