I'm using Apache, PHP (MAMP) in OSX environment, and Symfony framework for develpment. Symfony requires the use of Virtual Host for development locally, so I've added these lines on my /etc/apache2/hosts
file:
127.0.0.1 frontenda.dev
127.0.0.1 frontendb.dev
Then at my /Applications/MAMP/conf/apache/extra/httpd.vhosts.conf
, I've added these lines:
<VirtualHost *:80>
ServerName frontenda.dev
DocumentRoot /Users/geo/Sites/frontenda/www/
</VirtualHost>
<VirtualHost *:80>
ServerName frontendb.dev
DocumentRoot /Users/geo/Sites/frontendb/www/
</VirtualHost>
I can open those folders from my browser by these urls http://frontenda.dev
or http://frontendb.dev
. My question is what should I do (if this is even possible) to use IP address instead of frontenda.dev
or frontendb.dev
? What I mean with that is, let say my machine ip 192.168.1.144
, can I do 192.168.1.144/frontenda
or even assigning different port number for different folder?
You can use Alias to map different paths to different directories
Alias /frontenda /Users/geo/Sites/frontenda/www
Alias /frontendb /Users/geo/Sites/frontendb/www
I've had a better answer. I get it working using xip.io from 37signals http://xip.io/ . You can do like this:
10.0.0.1.xip.io resolves to 10.0.0.1
www.10.0.0.1.xip.io resolves to 10.0.0.1
mysite.10.0.0.1.xip.io resolves to 10.0.0.1
foo.bar.10.0.0.1.xip.io resolves to 10.0.0.1
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.