How can I run a web server on OS X without admin access?
February 20, 2008 3:31 PM   Subscribe

How can I run a web server on OS X without admin access?

You'll just have to trust me on the reasons, but I want to to run a fully-functioning web server (or at least, one which can do dynamic pages in Perl or PHP) on OS X (Leopard) machines, without having the administrator password.

Having it on a USB stick seems the most likely approach -- a web server is an application after all, and I won't be able to install new applications without the admin password, but I will be able to run an application from a stick.

This guy says he's done it, but annoyingly, not how, and hasn't made the details available: http://www.developmentseed.org/blog/2007/aug/03/getting-web-server-run-usb-drive, and this guy says he's got a beta version with limited functionality but wants me to pay for it sight unseen: http://www.server2go-web.de/features/mac.html.

I reckon I'm probably clueful enough to attempt my own tweaks to MAMPP given a few starting hints. Would it be incredibly difficult?

Any other solutions or suggestions gratefully received of course.
posted by AmbroseChapel to Computers & Internet (14 answers total) 1 user marked this as a favorite
 
I don't think you'll be able to run anything on port 80 (or any low ports) without admin access.
posted by qvtqht at 3:45 PM on February 20, 2008


As long as you're not attempting to make it bind to a privileged port, there should be no particular difficulty.
posted by flabdablet at 3:47 PM on February 20, 2008


What they said. Running it on the web default, port 80 (or any port under 1024) -- not possible.

Running it on any unused port of your choosing >= 1024 -- no big thing.

Anyone accessing it will have to use, e.g., http://www.example.com:8080/rogueserver/index.html

And if you transferred all the same files you'd have on the USB drive to the hard drive, it would work the same -- the installer wants admin rights to write to put it in parts of the filesystem ordinary users can't write to, but the web server can run just as well under a user directory. (This is assuming you can write to some user directory and that Mac OS X isn't up to something bizarre that's at odds with UNIX norms.)
posted by Zed_Lopez at 3:56 PM on February 20, 2008


You probably want lighttpd or nginx.
posted by singingfish at 4:25 PM on February 20, 2008


MAMP
posted by Mwongozi at 7:47 PM on February 20, 2008


Response by poster: Mwongozi -- MAMP, which I mentioned in the OP, is not able to run off a USB key, and it's not possible to install or run it without admin access. So, not a very helpful answer.
posted by AmbroseChapel at 8:15 PM on February 20, 2008


Response by poster: Everyone else, thank you for your help ... more detail please?

Zed_Lopez, are you saying "just install MAMP on a computer where you do have access, then move its folders wholesale to the key, move the key to the non-admin computer and start it up"? I guess I could try it, but from my first link (developmentseed), it seems like the developers took quite a bit of time getting it to "play nice".

I'm asking this question because to me, that seems very unlikely to work.

Same for singingfish, are you suggesting the same thing? Install on a computer where I can su root, copy to USB drive, run on a computer where I can't?

Or can I install them somehow directly to the key?
posted by AmbroseChapel at 8:25 PM on February 20, 2008


Response by poster: I've done a bit of looking at MAMP, lighthttpd and nginx, and they all need admin access to run, even on a local install. So even if I could install to a USB drive, it doesn't look like I could run the server.

Or is that just a matter of housekeeping stuff like where it writes its log files? If I can redirect its logs to a world-writeable location, might it run when started as a non-admin user?
posted by AmbroseChapel at 8:47 PM on February 20, 2008


well with lighttpd you'll be doing:

$ export $LOCATION= ~/lighty # or /Volumes/myusbstick/lighty or whatever
~/Desktop/lighttpd-1.4.18$ mkdir $LOCATION
~/Desktop/lighttpd-1.4.18$ ./configure --prefix=$LOCATION
~/Desktop/lighttpd-1.4.18$ make
~/Desktop/lighttpd-1.4.18$ make install
~/Desktop/lighttpd-1.4.18$ cd $LOCATION


save the following as lighty.conf in $LOCATION

server.modules = (
"mod_access",
"mod_fastcgi",
"mod_accesslog"
)
server.document-root = "/tmp"

server.errorlog = "/tmp/error.log"
accesslog.filename = "/tmp/access.log"

server.bind = "127.0.0.1"
server.port = 1025

$LOCATION/$ ./sbin/lighttpd -f lighty.conf

actually I'm getting some dynamic library error with a fresh compile, but I do have an earlier version of lighttpd running as a normal user (lighttpd-1.4.13) on the same machine, so it is possible.
posted by singingfish at 2:14 AM on February 21, 2008


Response by poster: That's great, singingfish. Thanks so much for all the detail. I'm getting the same kind of error myself with the current version. It definitely looks like it's possible anyway.
posted by AmbroseChapel at 3:55 AM on February 21, 2008


Zed_Lopez, are you saying "just install MAMP on a computer where you do have access, then move its folders wholesale to the key, move the key to the non-admin computer and start it up"?

Sadly, no. I was just saying that if you had it running on a USB drive, it'd be easy to get from there to running it on the hard drive. But getting it into a state where it could run from either could be difficult if all you had to work with was an installer that assumed admin access.
posted by Zed_Lopez at 10:33 AM on February 21, 2008


well I had a go with a similar process with nginx and it was faster to compile. I tweaked the sample config file so that it was running on port 1024 and tada I got the "Welcome to nginx" message.
posted by singingfish at 12:50 PM on February 21, 2008


Response by poster: And I've done the same. I now have nginx running off a thumb drive, all installed from a non-admin account. Proof of concept, although I can see there's lots of tweaking ahead.

Thanks for your help.
posted by AmbroseChapel at 4:46 PM on February 21, 2008


Response by poster: In the end I went with lighttpd, because it was easier to get both Perl and PHP support working, after judicious editing of the config file -- nginx doesn't do Perl CGI out of the box at all, you have to write wrappers for it.

I'm still not sure I can run this particular install on the particular Mac where I need it, because the install on the USB drive was created on Panther, and some of the configuration may well be different on Leopard, but I'm confident I can re-create the process on Leopard and have a working server on a stick.
posted by AmbroseChapel at 8:35 PM on February 21, 2008


« Older Can I get a cheap flight by purchasing a ticket...   |   Old laptop, new trick: Laptop screen... Newer »
This thread is closed to new comments.