Reputation: 1183
I'm trying to setup on ubuntu, virtualhosts on different ports, but I can get it work. My configuration in sites-available looks like
NameVirtualHost 127.0.0.1:5050
Listen 5050
<VirtualHost 127.0.0.1:5050>
ServerName localhost
DocumentRoot "/var/www/example"
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/example/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
</VirtualHost>
and I added to the host file
127.0.0.1:5050 localhost
Upvotes: 1
Views: 2001
Reputation: 311238
The hosts
file maps names to ip addresses. It cannot be used to do anything with ports. You may only specify ports as part of your url (such as http://localhost:5050/
).
You can certainly run virtual hosts on ports other than 80, but you have to explicitly reference the port as I've indicated.
Upvotes: 1