5 ms·
Missed a couple: $ apache2 $ nginx My point is that while lots of languages include a web server in their standard library (one of these was a damn instal
by IgorPartola 6y ago
Missed a couple:
$ apache2
$ nginx
My point is that while lots of languages include a web server in their standard library (one of these was a damn install! Like yes you can pip/gem/npm/etc install a server, that doesn’t make it a one line web server), it is by no means a one liner any more than the above two examples can be considered bash one liners.
- the_pwner224 6y agoOn practically any linux (or mac) you can do $ python -m http.server 8080 to instantly start up a server in that directory. You can do this in multiple terminals to have multiple servers on different ports serving multiple directories. Nginx, Apache require significant configuration and reboot to apply changes. They're not at all comparable.
- sgc 6y agoApache usually just needs to reload the config file not reboot, and it's also often only a few lines to get whatever you want done. Reload might take 1/2 a second, but I doubt it takes even that long. Sure, if you want to load a module with a bunch of new functionality you might need the 2 seconds it takes to reboot unless you have thousands of sites, but that has been a rare experience in the last 7 years or so for me. If you have thousands of sites you are not using python server anyway. In the end apache config is relatively easy -- especially to just test stuff quickly --, it's the overall server security that is more nebulous due to the variety of attack vectors throughout the stack. I would guess all that is similar on Nginx. So sure, it is a little easier to just throw out a one liner, but it doesn't give you an environment that is similar to deploy, so the extra 2 minutes to open the apache config and reload is worth it to me for the implicit bug testing going on. Of course none of us has a horse in the race and to each his own on his own box. But it's fair to keep their names in the conversation at least.
- Joker_vD 6y agoThat comes really handy when you want to, say, transfer some files from your PC to your phone/tablet without uploading them somewhere else first.
- IgorPartola 6y agoHow is it more of a burden to install apache2 vs sinatra? “Significant configuration” required for a static web server with apache2 is limited to just a few lines of configuration specifying the directory you want to serve and on what port. Look, I love me an ad hoc HTTP server for development work, especially the one Python comes with, but calling it a one line web server is like calling “apt install postgres” a “one line database server”. It’a just not a one liner.
- ComputerGuru 6y agoNo, these don’t have configuration files and can be set up from the command line arguments.
- IgorPartola 6y agoOne of these is literally installing sinatra. And if you just want a server to serve static assets, nginx or apache2 will happily serve it out of your /var/www. Symlink what you want there and you don’t have to edit any config files or anything.