Follow Slashdot blog updates by subscribing to our blog RSS feed


Forgot your password?
PHP Programming Software The Internet Linux

Local Web Server For Web Development? 82

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?"
This discussion has been archived. No new comments can be posted.

Local Web Server For Web Development?

Comments Filter:
  • 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.

    • by AKAImBatman ( 238306 ) * <{akaimbatman} {at} {}> on Tuesday September 02, 2008 @10:18AM (#24842643) Homepage Journal

      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 [] 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 @10: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. :)

            • by crush ( 19364 )
              Yup YUM has changed a lot over the years. Seth Vidal and friends have been constantly refining it.
        • by Matt Perry ( 793115 ) <perry.matt54@[ ] ['yah' in gap]> on Tuesday September 02, 2008 @03: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"

        • on redhat based systems, youd do apt-get install httpd instead of apache.
      • Re: (Score:3, Interesting)

        by mstahl ( 701501 )

        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

      • Or you can configure it so that each vm has it's own ip address and then there are no port conflicts (assuming that you have a server per vm)
  • 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.

      • by FLEB ( 312391 )

        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 @10: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, and your web browser will send the Host header.

    • by Rob Kaper ( 5960 )

      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 @10: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 @10: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. []

  • I thought this project looked very promising : [] 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 [].
  • by Anonymous Coward

    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 (localhost) and with fake domain entries in /etc/hosts pointing to

    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 al

  • 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

  • You're not very clear with what you want. A virtual webserver could mean many things. Do you want to run it in a virtual environment like you're doing now? Even if you're running Linux as your host system you can use VMWare or VirtualBox (which is Open Source and runs on Windows too.) This would allow you to run another instance of Linux with your webserver.

    You could also just have multiple virtual hosts or virtual directories as part of your original Apache install. This would allow you to have a directory

  • Eclipse? (Score:1, Interesting)

    by Anonymous Coward

    Have you looked into Eclipse development? The WTP (Web Toolkit Plugin) makes it real easy to configure and deploy various types of web (and app) servers, all within the Eclipse VM.

  • 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!!
  • Configuration is quite simple, memory usage is less than apache, and it starts faster. If you do php debugging, php5-xdebug will help you. Also sudo lighttpd-enable-mod 10-fastcgi.conf will enable php as fcgi.
    • by Ant P. ( 974313 )

      I second this. Lighttpd + Postgres takes about 10-20 minutes to set up and config in Ubuntu, and I've had less bugs with it - Ubuntu's mod_php seems to throw a fit with my PHP code even though it's not using any nonstandard stuff.

  • I have just gone through pretty much this scenario myself. I wanted a web development server which I could access from out and about with my laptop and I wanted to be able to access the machine using ssh.

    First I tried 'sudo tasksel install lamp' which did its thing, but somehow failed completely to get php working. Then I decided I would give xampp a go and went down the 'sudo tasksel'/remove lamp selection/hit ok/find ubuntu bug which removes entire gnome desktop as well as lampp/report bug while reinsta

  • bash []

    rc []

    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 @03: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 []. 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 think the best path is, if your going to be releasing on the web, get the distro you'll be deplying onto, also make sure you have the same configuration files setup. I use this setup, it's fast and simple, and if items change on your live servers, it's easy to update your local (just copy files) instead of trying to "translate" the setup and configuration.
  • With Ubuntu you can easily do this by installing a single package that provides Apache, MySQL and PHP otherwise known as LAMP. Run the Synaptic package manager. Select the "Edit" menu and select "Mark packages by task". Select "LAMP server" and click Apply. Create /etc/apache2/httpd.conf with the following two line to enable PHP. AddType application/x-httpd-php .php .phtml AddType application/x-httpd-php-source .phps Run "sudo /etc/init.d/apache2 restart" and the configuration will be made.
  • I like Grandma's LAMP. It's a full LAMP VM that runs completely out-of-the-box without any tinkering.

Our business in life is not to succeed but to continue to fail in high spirits. -- Robert Louis Stevenson