<commit_before>
{
  "title": "Serving static files in LAN",
  "description": "While working on web UIs, it is often convenient to serve static files over HTTP in the local network, in order to test on different devices.",
  "template": "article.jade",
  "date": "2014-04-25",
  "path": "2014/04"
}

[OS X](https://www.apple.com/osx/) comes with `apachectl`, the Apache HTTP Server Control Interface, which lets you configure the preinstalled [Apache HTTP server](http://httpd.apache.org/) on your Mac.

To serve a particular directory on your system, you have to specify it in the Apache HTTP server configuration file located at:

    /etc/apache2/httpd.conf

Change these two lines (170 and 197 in my case):
    
    DocumentRoot "/Library/WebServer/Documents"
    <Directory "/Library/WebServer/Documents">

… to point to your desired path:

    DocumentRoot "/path/to/your/site"
    <Directory "/path/to/your/site">

Start the server:
 
    sudo apachectl restart

Now you can browse to `http://YourComputerName.local` with your phone or tablet to check your responsive design (located at `/path/to/your/site` on your Mac).

Trivial of course, but I kept forgetting. Maybe now, as I have written it down, on the next rare occassion when I have to fiddle with CSS, I will remember.

But wait! You don't really want to have [httpd](http://httpd.apache.org/docs/2.2/programs/httpd.html) running on your system, do you—I mean, who could possibly want that? Why not use [Node](http://nodejs.org/) to write a little server and save it to a file named `stserver.js`?

    var http = require('http')
      , st = require('st')

    http.createServer(st('/path/to/your/site')).listen(80)

Start the server (as `root` because of port 80):<commit_msg>Tweak<commit_after>
{
  "title": "Serving static files in LAN",
  "description": "While working on web UIs, it is often convenient to serve static files over HTTP in the local network, in order to test on multiple devices.",
  "template": "article.jade",
  "date": "2014-04-25",
  "path": "2014/04"
}

[OS X](https://www.apple.com/osx/) comes with `apachectl`, the Apache HTTP Server Control Interface, which helps to control the preinstalled [Apache HTTP server](http://httpd.apache.org/) on your Mac.

To serve a particular directory on your system, you have to specify it in the Apache HTTP server configuration file located at:

    /etc/apache2/httpd.conf

Change these two lines (170 and 197 in my case):
    
    DocumentRoot "/Library/WebServer/Documents"
    <Directory "/Library/WebServer/Documents">

… to point to your desired path:

    DocumentRoot "/path/to/your/site"
    <Directory "/path/to/your/site">

Start the server:
 
    sudo apachectl restart

Now you can browse to `http://YourComputerName.local` with your phone or tablet to check your responsive design (located at `/path/to/your/site` on your Mac).

Trivial of course, but I kept forgetting. Maybe now, as I have written it down, on the next rare occassion when I have to fiddle with CSS, I will remember.

But wait! You don't really want to have [httpd](http://httpd.apache.org/docs/2.2/programs/httpd.html) running on your system, do you—I mean, who could possibly want that? Why not use [Node](http://nodejs.org/) to write a little server and save it to a file named `stserver.js`?

    var http = require('http')
      , st = require('st')

    http.createServer(st('/path/to/your/site')).listen(80)

Start the server (as `root` because of port 80):
{'fraction_non_alphanumeric': 0.1092896174863388, 'fraction_numerical': 0.015530629853321829, 'mean_word_length': 3.823855755894591, 'pattern_counts': {'":': 10, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '362213', 'n_tokens_mistral': 1080, 'n_tokens_neox': 1007, 'n_words': 443}