Local Web Server For Web Development?
gwilymgj writes "I have been running Apache/MySQL for years using XAMP and WAMP on windows for web development. Recently I switched to using Ubuntu in VMware player, it is much faster and it also introduces me to a 'real' reason to play with Linux (been looking for a 'real' reason for ages). Are there any specific distributions which allow you to have a virtual webserver on your desktop? Any tips and tricks out there for this?"
You can run apache and listen only on your internal IP. There are plenty to choose from. I'd recommend openSuSE or slackware if you're brave.
They're using their grammar skills there.
There's nothing wrong with running a local-only web server. I do it all the time -- just bind it to localhost, rather than in_addr_any, and no one else can see your development system.
I have no idea what you mean by 'virtual webserver' in this context. If you're attempting to run virtual hosts through a local web server for development purposes, you can adjust /etc/hosts (or whatever the mechanism is on your OS) so that the domain names point to 127.0.0.1, and your web browser will send the Host header.
Build it, and they will come^Hplain.
> Are there any specific distributions which allow
> you to have a virtual webserver on your desktop?
> Any tips and tricks out there for this?
I use FreeBSD myself, it's rather well documented (in my experience most of the documentation is better than or on par with Linux), even if the tools aren't as slick and GUI.
That being said, in the end, the OS choice really should be that of the user. I've used Apache/MySQL in Windows, Linux and FreeBSD. My preferences are towards Windows and FreeBSD. Both (for me) are easy to admin, and while the latter is incredibly fast, the peformance hit with the former on small scale testing isn't that bad. I tend to be more concerned with ease of administration and the UI performance because on any of the operating systems, the web server performance is more than sufficient for small and medium scale testing (depending on hardware, YMMV).
That being said:
(1) Jailed/Sandboxed/VMed environments are a nice security touch to help keep your system safe.
(2) If MySQL and Apache are on the same server, you may want to turn of networking and use local sockets for some extra security. This is well documented in the config file comments.
(3) Likewise, you can turn off the remote access for Apache. If you are using a jailed/sandboxed/VM environment, then this may not be an option unless you want to open the browser from within the jail/sandbox/VM.
Currently I'm playing with some stuff (a friend wants me to get [not so-]Zen Cart working for him) on my desktop. I have apache/php/mysql in a jail under FreeBSD. I'm behind a firewall, so I don't bother much with port restriction on Apache. With PHP I used the secure/recommended config file, and with mysql, I turned off networking (using a local socket). There are instructions for generating self signed certificates using OpenSSL if that has relevance to your work. It's not hard, and google can get you what you need quickly, if it's relevant.
Hope that helps.
Self proclaimed typo king, and inventor of the bear destroying coffee table (patent not pending).
the term "virtual domains" used to apply to what we now called shared hosting. I think that's what he was talking about.
If that is the case, yes, you can configure multiple separate websites on the same server, all pointing to 127.0.0.1 (localhost) and with fake domain entries in /etc/hosts pointing to 127.0.0.1
It's simply a matter of enabling the NameVirtualHost option in httpd.conf
You just need a tutorial on configuring httpd.conf
If you really want to replicate the shared server environment, you should also install suphp, which is pretty much standard on hosting isps (including the one I run)
I have a fresh install of LAMP via source tarballs -- I like to have the most recent version, the performance is faster with a custom compile, and I get to apply patches manually. I use apt-get or yum (depending on the box) to install base libraries like libbz2-dev (bzip2-devel) so I don't have to manage the dependency chain.
No matter what you do, you should be running Linux to do it, running PHP on a Windows box is a stupid computer trick.
If you have the RAM (ie >= 2GB) using vmware player to run CentOS 5.2 or Ubuntu 8.04 in the background is perfectly acceptable, just do /sbin/ifconfig within the virtual server to find the ip it has obtained from the vmware player's dhcp server, it will always be the same unless you move/copy the image. Then configure that ip in your c:\windows\system32\drivers\etc\hosts file with your fake domain entries