问题
I have a computer that's running Windows 7, that I do most of my development on. I have a spare laptop running Ubuntu. They are both connected to the same wifi, and I'm developing in Rails. Is there a way that I can use my spare laptop (Ubuntu) as a local server for development and testing that I would be able to connect to through my other computer (Windows 7)?
If it's not possible, how would I use my computer (Windows 7) as a local server for testing in Rails? I have XAMPP installed, I just don't really know how to use it.
回答1:
First Install LAMP in Ubuntu. This is one of the thousands of links that explain How to do it. https://help.ubuntu.com/community/ApacheMySQLPHP
Second Add Sites to Ubuntu Server. Again this is one of the many links that explain how to do it. http://tuxtweaks.com/2009/07/how-to-configure-apache-linux/comment-page-1/#comment-1984
Finally open your server only locally,I mean Localhost for your home network. To do that edit the file /etc/hosts and add at the end of the file
127.0.0.1 mysite
replace "mysite" for the name of your site and reload apache
sudo /etc/init.d/apache2 reload
You can access to http://mysite from any computer in your home network
来源:https://stackoverflow.com/questions/11276916/how-to-set-up-local-server-for-development