Page 1 of 1

a little question about virtual host

PostPosted: 09. October 2015 22:49
by nery89
should i open another post to a little question about virtual host? here it is by the way, i'll move it elsewhere if it's too off-topic.
i want to run several sites for development test, so i came across this wonderful chance of virtual hosts
so, giving a try, i modified httpd-vhost.conf to have
Code: Select all
#default to xampp directory
<VirtualHost *:8081>
    ServerName local
    DocumentRoot "C:/Programmi-Portable/xampp-php5.6.12/htdocs/"
</VirtualHost>

#custom virtual host
<VirtualHost *:8081>
    ServerName wordpress.local
    DocumentRoot "C:/Programmi-Portable/xampp-php5.6.12/apps/wordpress/"
    <Directory "C:/Programmi-Portable/xampp-php5.6.12/apps/wordpress/">
        Require all granted
    </Directory>
</VirtualHost>


restarted apache service then...
if i put "127.0.0.1:8081/wordpress.local" in the browser bar i get nothing but object not found.
if i go to "127.0.0.1:8081/" istead it redirect as expected to "127.0.0.1:8081/dashboard".
what did i miss this time? :idea:

Re: a little question about virtual host

PostPosted: 09. October 2015 23:12
by Altrea
nery89 wrote:should i open another post to a little question about virtual host?

You should start a new thread for every new topic. That way it is easier to search an scan the forum to find your thread.
This time you don't need to do that because i have splitted your original topic and placed a new headline.

Back to topic:
You misunderstood namebased virtual hosts. If you define a vhost with the Servername wordpress.local than it is assumed that you access it by URL http://wordpress.local/
In your case for URLs where you append the project to your domain like http://127.0.0.1/wordpress/ you just need to name your folder the same (in this case wordpress) and place it in the root of your htdocs folder, so /xampp/htdocs/wordpress/.
Thats it, no need for virtual hosts.

Re: a little question about virtual host

PostPosted: 10. October 2015 08:36
by nery89
thank you very much!
so for example, i have to move my folder wordpress/ in xampp/htdocs/ and remove all that thing about virtual hosts.

but my goal was to link an external folder (e.g. dropbox or drive). if i want to link an external folder, is it possible? since i don't get anything but "ERR_NAME_NOT_RESOLVED" (now) from http://wordpress.local/
searching in the forum https://community.apachefriends.org/f/viewtopic.php?f=16&t=70627&p=241926&hilit=local+directory+folder#p241930, seems that i have to add the custom host in C:\Windows\system32\drivers\etc\hosts

by the way i'm not able to find better explanations on the guide (maybe they are there, but my poor english don't help me), so i'll proceed and tryed with system32!
Code: Select all
# localhost name resolution is handled within DNS itself.
#   127.0.0.1       localhost
#   ::1             localhost

127.0.0.1 localhost
127.0.0.1 wordpress.local

mmm... no luck i have to say. maybe i should restart the computer?

Re: a little question about virtual host

PostPosted: 10. October 2015 09:32
by nery89
the hell, i have to go to "http://wordpress.local:8081/", not "http://wordpress.local/"!!! https://youtu.be/10KObAQFmlY