iPod touchでOpenVPN＋Lighttpdなどの設定メモ

ほぼほぼ完全に自分用のメモです。

（かれこれ4年位この構成で落ちてないけど、ある日突然iPod touchが逝ってしまった時に、設定は全く覚えていないので・・・）

## lighttpd

/Library/LaunchDaemons/net.lighttpd.plist

```
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">

<dict>
    <key>Label</key>
    <string>net.lighttpd</string>
    <key>RunAtLoad</key>
    <true/>
    <key>KeepAlive</key>
    <true/>
    <key>Program</key>
    <string>/usr/sbin/lighttpd</string>
    <key>ProgramArguments</key>
    <array>
        <string>lighttpd</string>
        <string>-D</string>
        <string>-f</string>
        <string>/etc/lighttpd/lighttpd.conf</string>
    </array>
</dict>
</plist>
```

/etc/lighttpd/lighttpd.conf

```
server.document-root = "/var/mobile/public_html"
server.username = "mobile"
server.groupname = "mobile"
server.port = 80

server.modules = (
    "mod_access",
    "mod_alias",
    "mod_fastcgi",
    "mod_indexfile",
    "mod_dirlisting",
    "mod_proxy",
    "mod_auth",
    "mod_rewrite"
)

dir-listing.activate = "enable"
index-file.names = ( "index.php", "index.py", "index.cgi", "index.html", "index.htm")
url.access-deny = ( "~", ".inc" )

static-file.exclude-extensions = ( ".php", ".cgi", ".py" )
fastcgi.server = ( ".php" => ((
                     "bin-path" => "/usr/bin/php-cgi",
                     "socket" => "/tmp/php.socket"
                 )))


include "mimetype.conf"
```

/etc/lighttpd/mimetype.conf

```
# LightTPD Configuration file (MIMETYPE HANDLING)
#
# Use it as a base for LightTPD 1.0.0 and above.
# This version is built by WLMP Project - http://en.wlmp.project.net/
#
# $Id: mimetype.conf,v 1.0 2012/02/07 17:31:27 dtech Exp $

## Use the "Content-Type" extended attribute to obtain mime type if possible
mimetype.use-xattr          = "disable"

## mimetype mapping
mimetype.assign             = (
	".pdf"          =>      "application/pdf",
	".sig"          =>      "application/pgp-signature",
	".spl"          =>      "application/futuresplash",
	".class"        =>      "application/octet-stream",
	".ps"           =>      "application/postscript",
	".torrent"      =>      "application/x-bittorrent",
	".dvi"          =>      "application/x-dvi",
	".gz"           =>      "application/x-gzip",
	".pac"          =>      "application/x-ns-proxy-autoconfig",
	".swf"          =>      "application/x-shockwave-flash",
	".tar.gz"       =>      "application/x-tgz",
	".tgz"          =>      "application/x-tgz",
	".tar"          =>      "application/x-tar",
	".zip"          =>      "application/zip",
	".mp3"          =>      "audio/mpeg",
	".m3u"          =>      "audio/x-mpegurl",
	".wma"          =>      "audio/x-ms-wma",
	".wax"          =>      "audio/x-ms-wax",
	".ogg"          =>      "application/ogg",
	".wav"          =>      "audio/x-wav",
	".gif"          =>      "image/gif",
	".jpg"          =>      "image/jpeg",
	".jpeg"         =>      "image/jpeg",
	".png"          =>      "image/png",
	".xbm"          =>      "image/x-xbitmap",
	".xpm"          =>      "image/x-xpixmap",
	".xwd"          =>      "image/x-xwindowdump",
	".css"          =>      "text/css",
	".html"         =>      "text/html",
	".htm"          =>      "text/html",
	".js"           =>      "text/javascript",
	".asc"          =>      "text/plain",
	".c"            =>      "text/plain",
	".cpp"          =>      "text/plain",
	".log"          =>      "text/plain",
	".conf"         =>      "text/plain",
	".text"         =>      "text/plain",
	".txt"          =>      "text/plain",
	".dtd"          =>      "text/xml",
	".xml"          =>      "text/xml",
	".mpeg"         =>      "video/mpeg",
	".mpg"          =>      "video/mpeg",
	".mov"          =>      "video/quicktime",
	".qt"           =>      "video/quicktime",
	".avi"          =>      "video/x-msvideo",
	".asf"          =>      "video/x-ms-asf",
	".asx"          =>      "video/x-ms-asf",
	".wmv"          =>      "video/x-ms-wmv",
	".bz2"          =>      "application/x-bzip",
	".tbz"          =>      "application/x-bzip-compressed-tar",
	".tar.bz2"      =>      "application/x-bzip-compressed-tar",
	# default mime type
	""              =>      "application/octet-stream",
)
```

`/var/mobile/public_html/` にコンテンツを置く

## OpenVPN

/Library/LaunchDaemons/net.openvpn.plist

```
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
<plist version="1.0">
<dict>
        <key>Label</key>
        <string>net.openvpn</string>
        <key>KeepAlive</key>
        <true/>
        <key>Program</key>
        <string>/usr/bin/openvpn</string>
        <key>ProgramArguments</key>
        <array>
                <string>openvpn</string>
                <string>--config</string>
                <string>client.ovpn</string>
        </array>
        <key>RunAtLoad</key>
        <true/>
        <key>TimeOut</key>
        <integer>90</integer>
        <key>WorkingDirectory</key>
        <string>/etc/openvpn</string>
</dict>
</plist>
```

`/etc/openvpn/client.ovpn` に鍵を置く


## 3proxy

/Library/LaunchDaemons/ru.3proxy

```
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
<plist version="1.0">
<dict>
        <key>Label</key>
        <string>ru.3proxy</string>
        <key>KeepAlive</key>
        <true/>
        <key>Program</key>
        <string>/usr/bin/proxy</string>
        <key>ProgramArguments</key>
        <array>
                <string>proxy</string>
                <string>-i0.0.0.0</string>
                <string>-p8080</string>
                <string>-l</string>
        </array>
        <key>RunAtLoad</key>
        <true/>
        <key>TimeOut</key>
        <integer>90</integer>
        <key>WorkingDirectory</key>
        <string>/etc/3proxy</string>
</dict>
</plist>
```