简体   繁体   中英

How to access my LAMP virtual machine

I have an Ubuntu vm setup as a LAMP and I would like to access the localhost page of that machine and use that to test my websites. How can I access it?

  1. Best network settings are:

    bridge-networking attached to your actual ethernet interfaces

  2. in the vm verify your network settings

    ifconfig

if wrong, edit it here: /etc/resolv.con and /etc/network/interfaces and /etc/host*

  1. use the ip to access the vm if the hostname does not resolv from your machine

You could also setup Virtual Hosts in your Virtual Machine:


 # edit the Apache config
 $ sudo nano /etc/apache2/apache2.conf

# in apache2.conf, add these virtual host settings below the files node NameVirtualHost *:80

<VirtualHost *:80>
   DocumentRoot /var/www
   ServerName www.ubuntu.vm
   ServerAlias ubuntu.vm
</VirtualHost>

<VirtualHost *:80>
   DocumentRoot /var/www/wordpress
   ServerName www.wordpress.vm
   ServerAlias wordpress.vm
</VirtualHost>

Much more info on how to setup a LAMP Development Environment in a Virtual Machine available in my blog post at: http://jimfrenette.com/2013/11/virtual-machine-for-lamp-development/

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM