Say I want to host different sites on different ports. The internal ip of the server is 192.168.1.108, the external ip is 170.24.180.160. And the ports 80, 81 and 82 of 170.24.180.160 have been forwarded by my router. Now I want to host site80, site81 and site82 in port 80, 81 and 82 individually, so if enter 170.24.180.160:82 will go to the site82.
I tried this:
Listen 80
Listen 81
...
NameVirtualHost 170.24.180.160:80
NameVirtualHost 170.24.180.160:81
...
<VirtualHost 170.24.180.160:80>
ServerName site80
DocumentRoot /home/yy/Sites/site80
</VirtualHost>
<VirtualHost 170.24.180.160:8080>
ServerName site81
DocumentRoot /home/yy/Sites/site81
</VirtualHost>
...
But it gives error:
*Restarting web server apache2
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
[Wed Jun 27 16:10:25 2012] [warn] NameVirtualHost *:80 has no VirtualHosts
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
[Wed Jun 27 16:10:25 2012] [warn] NameVirtualHost *:80 has no VirtualHosts
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
Action 'start' failed.
The Apache error log may have more information.
My question is, based on the above schema, how to set up apache? Detailed example is much helpful. Thanks!