Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×
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:
  • by DragonTHC ( 208439 ) <Dragon.gamerslastwill@com> on Tuesday September 02, 2008 @10:07AM (#24842467) Homepage Journal

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

  • by AKAImBatman ( 238306 ) * <akaimbatman@g m a i l . c om> 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 [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 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.
  • by Anonymous Coward on Tuesday September 02, 2008 @11:21AM (#24843849)

    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

  • by Matt Perry ( 793115 ) <perry DOT matt54 AT yahoo DOT com> 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.

All the simple programs have been written.

Working...