Stories
Slash Boxes
Comments

News for nerds, stuff that matters

Slashdot Log In

Log In

Create Account  |  Retrieve Password

Local Web Server For Web Development?

Posted by timothy on Tue Sep 02, 2008 09:06 AM
from the start-the-daemon dept.
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?"
+ -
story

Related Stories

This discussion has been archived. No new comments can be posted.
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More
Loading... please wait.
  • 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.

    • DragonTHC pretty much nailed it. Nearly every distribution of Linux, BSD, Solaris, <insert your favorite Operating System here> ships with a web server. The darn things are a dime a dozen and can be found on freeware websites, as example code (Java, Python, Perl, C#, take your pick), as part of webapp servers (e.g. J2EE), as programming assignments, etc.

      The only real reason to run Apache in a VM is if there are specific applications you wish to configure before deploying them in a production system. e.g. If you're looking at deploying Wordpress or a web forum, you may want to try a test install before sending it to your live server. In that case, the best answer for which OS to run in the VM is: Whatever you're planning on deploying the app on.

      Otherwise there is precious little difference between deploying a web server in a VM and deploying it on your desktop. (Regardless of what OS you use.) You can pick and choose to your heart's content. You can even run Apache, IIS, and J2EE on the same box without clobbering each other. (Just make sure you configure the ports to not conflict.)

      Heck, I've caught myself running as many as three web servers simultaneously while doing development. (Don't ask. You probably don't want to know.) When I'm done with them, I just shut them down and forget about them until the next time I need them.

      So go pick your favorite OS [distrowatch.com] and have fun. There's no need to shy from any of them, especially when you are using a virtual machine. And remember! FreeBSD is the Power to Serve(TM). </kidding!>

      • by Fallingcow (213461) on Tuesday September 02 2008, @09:52AM (#24843281) Homepage

        To put it (slightly) more consisely:

        Pick any distro.

        Type "apt-get install apache" at the command line.

        If that doesn't work, try "yum -i apache" (I think that's it, silly RPM-based distros).

        If it's still not working, you may be running Gentoo. Don't worry, it will be OK. Type "emerge apache". Go make some coffee. Maybe see a movie. Come back. Should be done.

        If that doesn't work, you're running Slackware. HERE BE DRAGONS!

        • If that doesn't work, try "yum -i apache" (I think that's it, silly RPM-based distros).

          Errmmm... that would be an absolutely and completely incorrect option to give to YUM. It's probably best to withhold giving advice about programs you've never used. The correct command would be:
          yum install apache
          See man yum for more details. Thanks to YUM the "silly RPM-based distros" (yes, I know it's a joke) have absolutely no problems with what people used to call "dependency hell" years ago. YUM is fast and easy

          • I have used YUM, it's just been a few years :)

            YUM is fast and easy to use these days

            Whoa, I guess a lot has changed!

            I remember waiting so long for it to resolve dependencies that my (much slower) Gentoo machine could have already downloaded, compiled, and installed everything I needed :) Seriously, I'm glad to hear it's made progress. Back then, the only possible use I could see for it was as an avenue to install APT for RPM.

            • Oh, and incidentally, I believe I was thinking of "rpm -i [package-filename]". So that didn't just come from no-where. :)

            • Yup YUM has changed a lot over the years. Seth Vidal and friends have been constantly refining it.
        • by Matt Perry (793115) on Tuesday September 02 2008, @02:05PM (#24847923)

          Type "apt-get install apache" at the command line.

          Or "apt-get install apache2" if you don't want to be in the web server stone age.

          • Oooh, yeah. I always forget about that and have to uninstall the damned thing. One of the few areas where Ubuntu's behavior isn't what I'd expect it to be. Make the nuts type "apt-get install apache1" or something. "apache" should mean "Apache 2"

          • by theelectron (973857) on Tuesday September 02 2008, @10:26AM (#24843933)
            It sounds like he already has the hardware, why would he buy a whole new computer just for a web server? You sound like an apply fan with the 'just buy a new one' upgrade/install path.
            • by dintech (998802) on Tuesday September 02 2008, @10:43AM (#24844341)

              You sound like an apply fan

              Gotta hate those apply fans. They're not happy until they've entered every competition and tried to get an interview for every job...

            • Why is parent modded troll, he has a valid point.
              And, on top of that, Leopard's Apache doens't come with GD "out of the box".

              • Because buying a whole new computer, from any manufacturer, just to run a local web server is a ridiculous suggestion for the submitter's needs.

                • Nevermind, I was talking about the guy that dais "why would he buy a whole new computer just for a web server". it was modded troll. I've replied the wrong message. Anyway, he's not troll anymore...

                  • Ahh... Ok. When I read your post he was no longer modded troll, which I guess caused my confusion.

                    Sorry for the mix up, it seems that you and I are in agreement after all.

          • Macs come with a webserver installed and running at boot by default?

            That sounds like a horrible idea.

            OTOH, a single command (or a quick search->highlight->install in Synaptic, if you want the GUI route) will download, install, and give a best-guess default configuration for Apache in Ubuntu.

            I'm betting it takes at least that much work to get the web server running on a fresh-out-of-the-box Apple machine, since I find it hard to believe that every single Mac out there is throwing away memory and cycles

            • I'm betting it takes at least that much work to get the web server running on a fresh-out-of-the-box Apple machine, since I find it hard to believe that every single Mac out there is throwing away memory and cycles on a webserver by default, even if it's being used for video editing.

              Apache isn't running as default - you need to check the box marked 'Web Sharing' in the 'Sharing' panel of System Preferences to get it to run.

              Getting an OpenSSH daemon to run is similarly complicated - there's a 'Remote Login'

              • Note though that the built in Mac apache is compiled in 64-bit mode but PHP always tries to compile to 32-bit mode. So if you try to upgrade the PHP module, you will get errors. The way around this is to force PHP to use the 64 bit architecture (but not darwin, you have to use a generic 64-bit), or recompile apache in 32 bit mode. You'll have to do the same for any shared modules that interact with Apache on the Mac.

            • They come with a webserver installed and ready to run at boot by default. You've gotta hit the Enable button first =)

              • I find it hard to believe that anyone would believe that every single Mac is running a webserver by default. I think you are feigning ignorance in a troll attempt.

                No.

                I was responding to the implication that Apple computers had something "out of the box" that was identical to what I was talking about, when they don't.

                On many Linux distros, including most of the popular ones, it's a couple clicks or one line in a terminal to both install and start running at boot an apache webserver. I was responding to, "Or

                • [...] but then again the Mac is wasting disc space by having Apache installed but disabled by default, not to mention that you *did* have to wait for it to install, it was just done during the system install [...]

                  Just a small detail: You don't "install" the OS when you get a Mac. You plug it in, your power it on, it works.

                  So yes you are right, Apache is taking space on the hard drive of every Mac user (unless they deleted it). But enabling Apache is a simple checkbox, too. How much room does Apache take, an

                  • Just a small detail: You don't "install" the OS when you get a Mac. You plug it in, your power it on, it works.

                    Oh, right. Duh. I guess it's just that most of the times I'm in contact with OSX, it's to install it or upgrade it :)

          • Or: buy a Mac, and it works out of the box.

            So wait, a Mac comes with apache installed and active by default? That sounds like a pretty dangerous security hole.

      • Re: (Score:3, Interesting)

        It's kind of hard to understand why, if he already had XAMP and WAMP, he'd want to be using anything else as a simple development environment. For testing prior to deployment a VM is great; even better—if downtown would actually cost you enough money it's worth doubling up—get a second hosting just like your production one and call it staging.

        Also, it's worth pointing out that Gentoo has great support for CMSes and similar things via the webapp-config command. It took me a few tries to realize h

  • Just install whatever webserver you were going to use. If you're nervous, configure it to only listen on localhost.

  • LAMP is supported in most (if not all) GNU/Linux distributions, and it is certainly supported in both the server and desktop versions of Ubuntu.

    • Why the single P? I'm pretty sure it's XAMPP, WAMPP, and LAMPP.

      Also I second LAMPP. Since you're already familiar with XAMPP, LAMPP will not take you long to get used to.

      • IIRC, the original acronym was LAMP-- Linux, Apache, MySQL, and PHP*, which is a completely usable setup as it is. Perl* (the extra "P") is often found in most _AMP packages, so-- especially when referring to an offering or package, as opposed to a requirement-- _AMPP is used.

        * Or is that the other way around? Did the "LAMP" terminology arise with Perl or PHP?

  • by oneiros27 (46144) on Tuesday September 02 2008, @09:11AM (#24842513) Homepage

    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.

    • And if you have a static IP and your router/firewall supports NAT (which doesn't these days), you could even access your development site remotely through a proper DNS name.

      Depending on your needs you'll want to add some security/safety measures, which can be as little as a local robots.txt file such as:

      RewriteCond %{HTTP_HOST} (dev|localhost).example.(.*)
      RewriteRule ^robots.txt /robots.local.txt [L]

      or a proper authentication system.

  • by SendBot (29932) on Tuesday September 02 2008, @09:11AM (#24842515) Homepage Journal

    Sounds like you already have what you're asking for. I run a full linux web dev environment in vmware on windows. It's very convenient, having its own IP address and saving me the hassle of running a separate machine. I have my web folders accessible through samba and can experiment freely without worrying about botching anything up.

    Am I missing something about the question?

  • What i like about vmware is that i can set up a server environment on my desktop in vmware using windows2003 server, and run it as is. This allows me to develop the code for web dev in vs2005 and then try to run it on the server as is, this will also bring up any issues should there be any that could be unforeseen as a developer using his own machine, therefor letting me know what needs to be configured on the server to run before giving it to my client.

    In your case, i imagine the same applies, however it i

  • Run Apache (or whatever else you intend to use), set it up to listen only on localhost, and you're good to go. Admittedly, distros could make this particular setup a little easier, but it's been possible for years.

  • by ByOhTek (1181381) on Tuesday September 02 2008, @09:20AM (#24842663) Journal
    > 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.
  • From what I understand your environment is a virtual machine with Ubuntu, and you are wanting a web server to run for development. Like many of the other people Apache "may" be your best best since it sounds like you are familiar with it from WAMP. I am not sure what you mean by virtual webserver unless you mean you want your virtual machines web server to be exposed to your host machines browser. If that is the case you need to see first which IP your virtual machine has been bound to, see which IP apache
  • When I read the title, I thought, "XAMP". It's really the easiest way there is. I can't imagine what you'd have been doing with it to make it slow for development work.

    And then, VMWare. Sounds like you have it working. What do you need it to do, that it's not already doing?

  • If your servers are running on Ubuntu use that. Just use whatever most closely matches your production environment. One less potential source of problems.

    Then share out your needed directories from the virtual machine via samba, edit up your hosts file, and away you go.

    http://paulmarsh.net/rails-development-under-windows-xp-or-osx-or-any-other-os [paulmarsh.net]

  • I thought this project looked very promising : https://launchpad.net/mysql-sandbox [launchpad.net] Instantly run one or many SQL Servers as a back end, will even do clustering for you if you want. YMMV
  • Nptlabs is currently in development on an online Wed Development Environment located on EC2. It uses nxserver to function as though it is local. If you are interested check out http://projectcodemonkey.wetpaint.com/ [wetpaint.com].
  • If you have a spare machine and only a few machines on your home network, you might as well have a dedicated machine for development.

    Any distro will work... if you are familiar with Ubuntu already, that's fine. Install Apache, MySQL (and/or your preferred database), your scripting languages of choice (PHP, Python, Ruby, Perl, etc), and whatever else you need. Learning real system administration never hurts.

    I have my dev box set up to use vhosts. I handle DNS via HOSTS files on each box, as I only have ab

  • I would like to point out that you want to run versions that are as close to what you will use in production as possible. I do this in a corporate environment where we got so tired of helping developers remove "c:" from the paths of application to be deployed on unix. We created a VMware version of the web server to run in linux. Makes life much easier!!
  • bash [blogspot.com]

    rc [proweb.co.uk]

    or python, or perl or awk or anything really.

    If you want to learn, write your own, http isn't that hard unless you plan to get fancy

  • You've been using apache and mysql for years, yet you've been looking for a "real" reason to use linux for years? You had a couple good ones right there, man...

    As for the phrase "virtual webserver on your desktop": That means nothing. You want a real (ie, "non-virtual") webserver, because you want to serve files. You don't want a webserver anywhere near your desktop, as apache's not a GUI application. So I suppose the answer is "No, you have to have a real webserver, but you can probably access it via a

  • Download and install Apache for Linux.

    Seriously, why does the post have to be so...complex? It's called Apache. It's a web server. You want to run it on a virtual host or run the program virtually, that's your business.
  • by smchris (464899) on Tuesday September 02 2008, @02:47PM (#24848697)

    Run XP in Qemu/kvm on Debian. I guess windows give you IIS development.

    I vote "whatever" with many. You've used Ubuntu, stick with Ubuntu.

  • If you are already running VMWare, then I would recommend downloading a pre-configured virtual appliance [vmware.com]. They are ready-to-go VM W/X/LAMP installs that sometimes even offer a slimmed down version for minimal footprint; pick one that resembles the target production environment and you are ready to go.
  • Most Linux distributions include some kind of web server. By default that will be Apache on all the major ones. Some will include LIGHTTPD, too, which you may be able to consider using instead of, or in addition to, Apache. Just do a minimal server install of a favorite major Linux distribution (or BSD) in a virtual machine. Do two virtual machines while you are at it, and you have an extra one to experiment with while not disrupting your web server testing.

  • I like Grandma's LAMP. It's a full LAMP VM that runs completely out-of-the-box without any tinkering.