Page 1 of 1

Cannot access virtual hosts by name

PostPosted: 17. July 2016 18:43
by Tariel
Xampp used to work before, but one time my computer restarted itself when I wasn't home, and after that it could no longer connect to port 80. After this I changed the port to 1234. It's able to connect, but it cannot access any of the virtual hosts by name. Also if I add NameVirtualHost *:1234 to the vhosts file, it gives a warning that there are no virtual hosts for 1234. In the past when I used port 80, I didn't have this line at all and it was still working, but some sites claim you're supposed to have it.

The contents of my vhost file.

NameVirtualHost *:1234

<VirtualHost *:1234>
ServerAdmin postmaster@dummy-host.localhost
DocumentRoot "C:/xampp/htdocs/phpMyAdmin"
ServerName phpmyadmin.loc
ServerAlias http://www.phpmyadmin.loc
ErrorLog "logs/phpmyadmin_loc_error.log"
CustomLog "logs/phpmyadmin_loc_access.log" combined
</VirtualHost>

<VirtualHost *:1234>
ServerAdmin postmaster@dummy-host.localhost
DocumentRoot "C:/xampp/htdocs/otherworld/www"
ServerName otherworld.loc
ServerAlias http://www.otherworld.loc
ErrorLog "logs/otherworld_loc_error.log"
CustomLog "logs/otherworld_loc_access.log" combined
</VirtualHost>

Also I can't change back to port 80 because it still says something about port 1234, so it continues being defined somewhere even if I try to switch back to 80. I would rather use another port than 80 so I wouldn't have to disable skype. I already disabled some Windows server program that was interfering with it in the beginning, and it no longer appears on the list of programs.

If I go to localhost:1234 it loads phpmyadmin which is the default, but there's no way to access otherworld.loc. If I type that into the address bar, it gives a blank page.

Re: Cannot access virtual hosts by name

PostPosted: 17. July 2016 20:56
by Altrea
Who said you need to disable Skype to free port 80?

Re: Cannot access virtual hosts by name

PostPosted: 17. July 2016 21:17
by Tariel
Several topics I found on Google said that Skype tends to use port 80. I found a way to stop Skype from using port 80, so that's no longer an issue, but some windows process might be using it.

Anyway, I found a workaround. If I write otherworld.loc:1234 instead of just otherworld.loc, I can access my local file. I'm not sure why it was unnecessary to include the port number when it was 80 but this isn't too much extra work.

Re: Cannot access virtual hosts by name

PostPosted: 17. July 2016 21:40
by Nobbie
Tariel wrote:SI'm not sure why it was unnecessary to include the port number when it was 80 but this isn't too much extra work.


Because port 80 is the default port for http, that means, if you do not specify any port, port 80 is taken. Each protocoll in TCPIP has its default ports, so for example default port for FTP (another protocoll than HTTP) is 21. Usually you have to apply a port number always, but if you ommit it, the default port is taken.

Wikipedia provides a list of all default ports in TCPIP:

https://en.wikipedia.org/wiki/List_of_T ... rt_numbers