Posts tagged net


XGQT.Org gallery

:: art, blog, net, sigal

By: Maciej Barć

My image gallery is up on xgqt.org/gallery.

It is a million times better than Instagram and also it has no likes or comments - that’s a feature!

I build it with Sigal which outputs to static HTML pages.

Sigal script

1
2
3
4
5
6
7
out="/var/www/xgqt.org/htdocs/gallery"
mkdir -p "${out}"
sigal build                         \
      --config ./sigal.conf.py      \
      --title Gallery               \
      ./pictures/ "${out}"          \
      "${@}"

See also

Running nginx under a local user

:: linux, net, nginx, tutorial

By: Maciej Barć

Config

First let’s prepare a suitable nginx configuration file.

This one is pretty bare but it works well for our case:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
worker_processes 1;
daemon off;
pid ./nginx/temp/nginx.pid;

error_log /dev/stdout info;

events {
    worker_connections 1024;
}

http {
    client_body_temp_path ./nginx/temp/client 1 2;
    proxy_temp_path ./nginx/temp/proxy;
    fastcgi_temp_path ./nginx/temp/fastcgi;
    uwsgi_temp_path ./nginx/temp/uwsgi;
    scgi_temp_path ./nginx/temp/scgi;

    server {
        listen 127.0.0.1:8080;
        server_name localhost;

        access_log /dev/stdout;
        error_log /dev/stdout info;

        root ./;

        location / {
            autoindex on;
        }
    }
}

Server config is set up for serving all static files from the current directory.

Startup

Preparation

Based on how you want to store _temp_path files it might be necessary to create (or clean up) additional directories, for example:

1
2
rm -r ./nginx/temp
mkdir -p ./nginx/temp

Run in current directory

1
nginx -c ./nginx.conf -p ./

BTW, you may want to replace ./ with "$(pwd)" and occurrences in the config with static paths.

Bonus: other simple servers

Some of no-dependency-except-itself http servers it’s good to know about:

Python http.server

1
python3 -m http.server -b 127.0.0.1 8080

Busybox

1
busybox httpd -f -p 127.0.0.1:8080 -v

You can read more about configuring busybox’s httpd on OpenWRT docs.

Old Access Point

:: hardware, linux, net

By: Maciej Barć

Introduction

On some old routers, namely TP-Link's TL-WR840N version 2, there may not be a option to switch to access point mode. This is what you have to do to access that mode indirectly.

Steps

  • Power off the router
  • Unplug RJ cable from the WAN port
  • Connect the router to a PC (using one of the LAN ports)
  • Power on the router
  • Log it to the web console entering your router's IP, you can find out the IP by executing ip --color a (on a Linux box) if the router's DHCP server is still active
  • In LAN settings give your router a static client IP that fits into a network you want to connect it to; example: 192.168.100.100/24 (make sure no other hosts are associated with that IP in the target network)
  • Restart the router
  • Log in to the web console entering the IP you have set
  • Turn off the DHCP server (DHCP -> DHCP Settings -> DHCP Server: Disable & Save)
  • Power off the router
  • Plug the cable from a network you want the router connected to to one of the LAN ports
  • Power on the router
  • Log in to the web console entering the IP you have set
  • Turn on the wireless network and set it up (SSID, password, etc.)
  • Done! :D

Sources