Problem prilikom postavljanja vistualhost na localnoj masini

nasao sam nekoliko tutorijala na internetu kako da postavim vistualost na localnoj masini i uglavnom su iste ili jako slicne.
moj plan je u stvari da napravim virtualni host za svaki projekt koji radim na svom laptopu. tako da umjesto http://localhost/afan.net koristim http://dev.afan.net i kad je sve gotovo jednostavno prebacim na (pravi) server. koristim Ubuntu 8.04

evo kako sam uradio:

  1. u /home/pasalica/www/ sam kreirao directorij dev.afan.net
  2. promijenio “vlasnistvo”: shown -R www-data:www-data dev.afan.net (ne znam da li je to nephodno ili ne, ali nisam primjetio da mi je to proizvelo grasku?)
  3. u /etc/host (bio je totalno prazan) sam dodao liniju
  1. u /etc/apache2/site-available sam naravio kopiju od vec postojeceg default u dev.afan.net.conf. default izgleda ovako:

[code]NameVirtualHost *
<VirtualHost *>
ServerAdmin webmaster@localhost

DocumentRoot /var/www/
<Directory />
	Options FollowSymLinks
	AllowOverride None
</Directory>
<Directory /var/www/>
	Options Indexes FollowSymLinks MultiViews
	AllowOverride None
	Order allow,deny
	allow from all
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
	AllowOverride None
	Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
	Order allow,deny
	Allow from all
</Directory>

ErrorLog /var/log/apache2/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog /var/log/apache2/access.log combined
ServerSignature On

Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
    Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>

[/code]
5.modifikovao sam dev.afan.net.conf " za moje potrebe" u ovo:

[code]NameVirtualHost *
<VirtualHost *>
ServerAdmin webmaster@localhost

ServerName dev.afan.net

DocumentRoot /home/pasalica/www/dev.afan.net/

ErrorLog /var/log/apache2/error.log
LogLevel warn
CustomLog /var/log/apache2/access.log combined

[/code]
6. napravio link

  1. kad restartuje apache
    /etc/init.d/apach2 restart
    dobijem ovo

[code]pasalica@Ubuntu3325:/etc/apache2/sites-enabled$ sudo /etc/init.d/apache2 restart

  • Restarting web server apache2 apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName
    [Fri Jun 12 07:35:13 2009] [warn] NameVirtualHost *:0 has no VirtualHosts
    apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName
    [Fri Jun 12 07:35:23 2009] [warn] NameVirtualHost *:0 has no VirtualHosts
    [ OK ]
    pasalica@Ubuntu3325:/etc/apache2/sites-enabled$[/code]
    pokusao sam odgonetnuti ovu gresku ali ne ide.

svaka pomoc je dobro dosla
:smiley:

iz dev.afan.net.conf sam izbacio prvu liniju
NameVirtualHost *
tako da je taj problem rijesen.

ponovo sam restartovao apache i dobio ovo:

[code]pasalica@Ubuntu3325:/etc/apache2/sites-available$ sudo /etc/init.d/apache2 restart

  • Restarting web server apache2
    apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName
    apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName
    [ OK ]
    pasalica@Ubuntu3325:/etc/apache2/sites-available$[/code]

good news:
prema http://blog.evolutioncreations.com/2008/07/apache2-could-not-reliably-determine.html
dodao sam liniju
ServerName localhost
u /etc/apache2/httpd.conf
i nemam vise greske tokom restartovanja apache-a

bad news:
kad otvorim http://localhost dobijem “It Works!” - sto i treb da bude.
medjutim http://dev.afan.net ne radi?

pokusao sam i sa promijenom u /etc/apache2/httpd.conf, umjeto localhost da stavim dev.afan.net ali opet nista. localhost i dalje radi a “development” ne radi :frowning:

Pa jel za dev.afan.net postavljen A record na IP tvog racunara?

mozel’ malo detaljnije. sto bi rekle kolege sa BBC-ja: talk to me like I’m 4
:smiley:

sta je A record?

echo “127.0.0.1 dev.afan.net” >> /etc/hosts

pogledaj post br.1, pod 3.)
:smiley:

probao sam i da obrisem sve osim dev.afan.net ali i dalje isto

Address Not Found
Firefox can’t find the server at dev.afan.net.

Prvo, naveo si /etc/host a treba /etc/hosts
Drugo, dobro pogledaj da li je na Ubuntu Linux localhost postavljen 127.0.0.1 ili 127.0.1.1
(sve savrseno legalno, 127.0.0.0/8 )

:wq

[quote=adis]Prvo, naveo si /etc/host a treba /etc/hosts
Drugo, dobro pogledaj da li je na Ubuntu Linux localhost postavljen 127.0.0.1 ili 127.0.1.1
(sve savrseno legalno, 127.0.0.0/8 )

:wq[/quote]
do mene, do mene, do mene…!!!
da, ja sam ubacio navedenu liniju u /etc/host
/etc/hosts

[code]127.0.0.1 localhost dev.afan.net
127.0.1.1 Ubuntu3325

The following lines are desirable for IPv6 capable hosts

::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts[/code]
restartov’o sam apache i sada http://dev.afan.net m idaje isto sto i http://localhost - sto je pogesno?!?

tail -f /var/log/apache/access_log pa gledaj sta javlja…

u najvecem broju:

127.0.0.1 - - [12/Jun/2009:13:28:30 -0500] "OPTIONS * HTTP/1.0" 200 - "-" "Apache/2.2.8 (Ubuntu) PHP/5.2.4-2ubuntu5.6 with Suhosin-Patch (internal dummy connection)"

sto mi bas i ne govori bas puno :smiley:

u stvari ima razlike:
kada otvorim http://localhost dobijem ovaj record u access.log
127.0.0.1 - - [12/Jun/2009:14:43:55 -0500] “GET / HTTP/1.1” 304 - “-” “Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.10) Gecko/2009042513 Ubuntu/8.04 (hardy) Firefox/3.0.10”

a kada otvorim http://dev.afan.,net dobijem
127.0.0.1 - - [12/Jun/2009:14:44:01 -0500] “GET /index.html HTTP/1.1” 304 - “-” “Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.10) Gecko/2009042513 Ubuntu/8.04 (hardy) Firefox/3.0.10”

?!?!?!!?

Hajde samo ono iz pocetnog post-a pod br. 5 ubaci u /etc/apache2/sites-available/dev.afan.net , zatim a2ensite dev.afan.net i /etc/init.d/apache2 restart

kako mislis “hajde samo ono…”? mislis da obrisem sto sam radio pa da sve to ponovim ispocetka?