Hi there!
I’d like to recreate locally an environment similar to our dedicated server.
Therefore I’ve installed on my PC Windows 7:
- Apache 2.2.21
- PHP 5.3.8
- MySQL
- phpMyAdmin
I am also running IIS on the same PC, so I’ve set Apache on the port 8080.
Everything works fine so far and I did not have any problem.
However I wanted to be able to browse multiple websites locally just typing “mywhateverwebsitename” instead of “localhost:8080”, but it seems I am unable to do it.
I am Administrator on this PC.
I’ve edited the httpd-vhosts.conf file and the Windows hosts file.
In the httpd-vshosts.conf file I have:
NameVirtualHost *:8080
<virtualhost *:8080>
DocumentRoot "C:/DEV/php/"
ServerName phpserver.site
ServerAlias www.phpserver.site
<directory "C:/DEV/php">
AllowOverride All
Options Indexes FollowSymLinks
Order allow,deny
Allow from all
</directory>
</virtualhost>
<VirtualHost *:8080>
DocumentRoot "C:/DEV/php/"
ServerName testsite
</VirtualHost>
In the hosts I have just:
127.0.0.1 localhost
127.0.0.1:8080 phpserver.site
127.0.0.1:8080 www.phpserver.site
127.0.0.1:8080 testsite
I did not have any issue with permissions.
If I write in the hosts file the line
127.0.0.1 www.altavista.com
and then try ping www.altavista.com all seems fine and the ping shows the local IP.
If I write in the hosts file the line
127.0.0.1:8080 www.altavista.com
and then try ping www.altavista.com it shows the real public IP of altavista.
If I write
127.0.0.1 phpserver.site
and ping it works and shows the local address (and it shows the IIS home in the browser). If I type
127.0.0.1:8080 phpserver.site
and then try to ping phpserver.site it does not work and the browser shows nothing (not found).
Clearly the hosts file is working properly, and I do not understand where the problem is and if I can do what I want on this PC with this configuration.
I’ve tried to read as much as possible on the topic before posting here, but nothing seems to work, therefore I’m assuming there is something I don’t know or did not understand!
I would really appreciate some help!!
Many thanks!!!