ini 重写规则以将路径的一部分转换为查询字符串键/值对

重写规则以将路径的一部分转换为查询字符串键/值对

apache_rewrite.ini
RewriteEngine On

#
# This rewrite rule will change a URI from something like :
# http://foo.com/corpus/59/d0/400_59d022a8dcc082473fac85dbb219e724SongStream-ParadeofLights-ServerSide-640x765.png
# Notice this part of the URI ^^^ -- that becomes a query parameter...
# i.e, into http://foo.com/corpus/59/d0/59d022a8dcc082473fac85dbb219e724SongStream-ParadeofLights-ServerSide-640x765.png?width=400
# 

#
# This should be placed in the 'root' of the httpd.conf file. 
# This is done so that all the VirtualHost, <Directory> level rewrites/aliases will take over.
#

# If the query string is empty..
RewriteCond %{QUERY_STRING} ^$ [OR]

# OR doesn't contain an explicit width= parameter in its query string..
RewriteCond %{QUERY_STRING} !width=

# Make sure that the request filename is not present
RewriteCond %{REQUEST_FILENAME} !-f

# Match the request URI against the following patterns:
# Match Group anything ahead of the final / (the actual file name) to %1
# Match the chars following the / to a integer number (this will become the 'width' query param to %2
# Ensure that there is a '_' char after the number
# Match and group the everything after the "_", but before the "." (the filename, sans extension) to %3
# Ensure that there is a '.' char after the filename
# Ensure that the chars after the '.' is a allowed extension, and group that into %4
# The NC flag makes sure that the match ignores case
RewriteCond %{REQUEST_URI} ^/(.+)/(\d+)_(.+)\.(png|jpg|jpeg|gif)$ [NC]

#
# Now, reconstruct the URI into the new format. Notice the QSA flag, which appends any other query
# parameters that might be present. We do want them to be passed on. Apache takes care of making sure there
# is only one '?' in the URI and all that.
#

#
# Also, notice the "PT" flag, which means 'passthrough', which allows other rules to cascade the URI.
# This lets things like aliases, which might be defined at the directory level, to work.
#
RewriteRule (.*) /%1/%3.%4?width=%2 [PT,QSA]

ini phpmyadmin nginx虚拟主机(php-fpm)

phpmyadmin nginx虚拟主机(php-fpm)

nginx.conf
server {

    # Listen on port 81
    listen 81;

    # Server name being used (exact name, wildcards or regular expression)
    # server_name phpmyadmin.my;

    root /usr/share/phpmyadmin;

    # Logging
    error_log /var/log/phpmyadmin.access_log;
    access_log /var/log/phpmyadmin.error_log;


   location / {
           index  index.php;
       }

       ## Images and static content is treated different
       location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
           access_log        off;
           expires           360d;
       }

       location ~ /\.ht {
           deny  all;
       }

       location ~ /(libraries|setup/frames|setup/libs) {
           deny all;
           return 404;
}

    # Pass the PHP scripts to FastCGI server
    location ~ \.php$ {

        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_split_path_info ^(.+\.php)(/.*)$;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME /usr/share/phpmyadmin$fastcgi_script_name;
        fastcgi_param  HTTPS off;
    }
}

ini .tmux.ini

.tmux.ini
# tmux config

# General {{{

set -g prefix `
unbind ^b

# Ring the bell if any background window rang a bell.
set -g bell-action any

# Default termtype. If the rcfile sets $TERM, that overrides this value.
set -g default-terminal screen-256color

# Status bar clock: month/day hour:minute
set -g status-right '%m/%d %H:%M'

# Watch for activity in background windows.
setw -g monitor-activity on

# ------------------------------------------------------------------------ }}}
# Colors {{{

# NOTE: these colors were chosen assuming Solarized Light in
# iTerm2. They might look horrible in other setups.

# Status messages and command input line
set -g message-bg cyan
set -g message-fg white

# Set border colors for panes. This works fine for multiple panes, but has
# no useful effect in a 2-pane window.
set -g pane-border-bg default
set -g pane-border-fg white
set -g pane-active-border-bg default
set -g pane-active-border-fg green

# Status line color
set -g status-bg blue
set -g status-fg white

# Coloring for left-most status indicator
set -g status-left-bg green
set -g status-left-fg white

# For copy-mode and such I think. Look into this later.
#setw -g mode-bg red
#setw -g mode-fg brightwhite

# Highlight the current window in the status line
setw -g window-status-current-fg brightwhite
setw -g window-status-current-bg black

# Highlight windows with activity.
# Note, this seems to use inverse behavior, bg=fg, fg=bg...
# It must set inverse by default.
setw -g window-status-activity-fg white
setw -g window-status-activity-bg brightred

# ------------------------------------------------------------------------ }}}
# Mouse handling {{{

# Honor mouse clicks if they are passed through by the terminal.
# Select windows and panes, and drag-resize panes.
# This is great and all but it really messes with copying via e.g. iTerm.
# I'm doing this with iTerm key maps using hex codes.
# set -g mouse-select-pane on
# set -g mouse-select-window on
# set -g mouse-resize-pane on

# This has to do with tmux copy buffers and the mouse.
# Kind of screwy, need to evaluate some other month.
# setw -g mode-mouse on

# ------------------------------------------------------------------------ }}}
# Key bindings {{{

# Keep your finger on ctrl, or don't.
bind-key ^D detach-client

# Create splits and vertical splits
bind-key v split-window -h
bind-key ^V split-window -h
bind-key s split-window
bind-key ^S split-window

# Pane resize in all four directions using vi bindings.
# Can use these raw but I map them to ctrl-opt-<arrow> in iTerm.
bind-key J resize-pane -D
bind-key K resize-pane -U
bind-key H resize-pane -L
bind-key L resize-pane -R

# Use vi keybindings for tmux commandline input.
# Note that to get command mode you need to hit ESC twice.
set -g status-keys vi

# Use vi keybindings in copy and choice modes.
setw -g mode-keys vi

set-option -g default-command "/opt/local/bin/reattach-to-user-namespace -l bash"
# ------------------------------------------------------------------------ }}}

ini haproxy.cfg节将启用Perfect Forward Secrecy和HTTP严格传输安全性。需要OpenSSL 1.0.1g左右。

haproxy.cfg节将启用Perfect Forward Secrecy和HTTP严格传输安全性。需要OpenSSL 1.0.1g左右。

haproxy.cfg
# Bind SSL port with PFS-enabling cipher suite
bind :443 ssl crt path_to_certificate no-tls-tickets ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-GCM-SHA384:AES128-SHA256:AES128-SHA:AES256-SHA256:AES256-SHA:!MD5:!aNULL:!DH:!RC4

# Distinguish between secure and insecure requests
acl secure dst_port eq 443

# Mark all cookies as secure if sent over SSL
rsprep ^Set-Cookie:\ (.*) Set-Cookie:\ \1;\ Secure if secure

# Add the HSTS header with a 1 year max-age
rspadd Strict-Transport-Security:\ max-age=31536000 if secure

ini nginx.conf

nginx.conf
http {
    lua_package_path '/data/coffinboat/?.lua;;';

    server{
        listen 80;
        server_name xxx.aoxuis.me;

        location /starlegend/ {
            lua_need_request_body on;
            content_by_lua_file main.lua;
        }
}

ini nginx.conf

nginx.conf
### Nginx upstart script
### source: http://serverfault.com/a/391737/70451
### /etc/init/nginx.conf

description "nginx http daemon"

start on (filesystem and net-device-up IFACE=lo)
stop on runlevel [!2345]

env DAEMON=/usr/local/sbin/nginx
env PIDFILE=/var/run/nginx.pid

# Needed to allow Nginx to start, however, the wrong PID will be tracked
expect fork

# Test the nginx configuration (Upstart will not proceed if this fails)
pre-start exec $DAEMON -t

# Ensure nginx is shutdown gracefully
# Upstart will be tracking the wrong PID so the following is needed to stop nginx
post-stop exec $DAEMON -s stop

# Start Nginx
exec $DAEMON

ini 用于nerdz的Lighttpd.conf

用于nerdz的Lighttpd.conf

lighttpd.conf
# This is a minimal example config
# See /usr/share/doc/lighttpd
# and http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ConfigurationOptions

var.server_root = "/srv/http"
server.use-ipv6 = "disable"
server.port		= 80
server.username		= "http"
server.groupname	= "http"
server.document-root	= "/srv/http"
server.errorlog		= "/var/log/lighttpd/error.log"
dir-listing.activate	= "enable"
index-file.names	= ( "index.html" )
alias.url = ( "/phppgadmin" => "/usr/share/webapps/phppgadmin/")

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" 
 )

include "conf.d/fastcgi.conf"

server.modules += ("mod_rewrite")

$HTTP["host"] =~ "^(mobile|dev)\.nerdz\.eu$" {
server.document-root = "/srv/http/nerdz"
server.errorlog = "/var/log/lighttpd/error.log"
accesslog.filename = "/var/log/lighttpd/access.log"
server.error-handler-404 = "/e404.php"
url.rewrite-once = (
  "^/(.+?)\.$" => "/profile.php?id=$1",
  "^/(.+?):$" => "/project.php?gid=$1",
  "^/(.+?)\.(\d+)$" => "/profile.php?id=$1&pid=$2",
  "^/(.+?):(\d+)$" => "/project.php?gid=$1&pid=$2",
)
}

server.modules += ("mod_auth")
auth.debug = 2
auth.backend = "plain"
auth.backend.plain.userfile = "/home/jarvis/.lighttpdpassword"
  
$HTTP["host"] == "jest.dlinkddns.com" {
server.document-root = "/srv/http/"
server.errorlog = "/var/log/lighttpd/error.log"
accesslog.filename = "/var/log/lighttpd/access.log"
auth.require = ( "/" =>
(
    "method" => "basic",
    "realm" => "Password protected area",
    "require" => "user=jest"
  )
)
}

$SERVER["socket"] == ":443" {
  ssl.engine = "enable" 
  ssl.pemfile = "/etc/lighttpd/certs/lighttpd.pem" 
}

ini 配置xorg.conf,包含AMD 7850的配置。

配置xorg.conf,包含AMD 7850的配置。

xorg.conf
Section "ServerLayout"
	Identifier     "aticonfig Layout"
	Screen      0  "aticonfig-Screen[0]-0" 0 0
EndSection

Section "Module"
EndSection

Section "Monitor"
	Identifier   "aticonfig-Monitor[0]-0"
	Option	    "VendorName" "ATI Proprietary Driver"
	Option	    "ModelName" "Generic Autodetecting Monitor"
	Option	    "DPMS" "true"
EndSection

Section "Monitor"
	Identifier   "0-DFP9"
	Option	    "VendorName" "ATI Proprietary Driver"
	Option	    "ModelName" "Generic Autodetecting Monitor"
	Option	    "DPMS" "true"
	Option	    "PreferredMode" "1920x1080"
	Option	    "TargetRefresh" "60"
	Option	    "Position" "1440 0"
	Option	    "Rotate" "normal"
	Option	    "Disable" "false"
EndSection

Section "Monitor"
	Identifier   "0-CRT1"
	Option	    "VendorName" "ATI Proprietary Driver"
	Option	    "ModelName" "Generic Autodetecting Monitor"
	Option	    "DPMS" "true"
	Option	    "PreferredMode" "1440x900"
	Option	    "TargetRefresh" "60"
	Option	    "Position" "0 0"
	Option	    "Rotate" "normal"
	Option	    "Disable" "false"
EndSection

Section "Device"
	Identifier  "aticonfig-Device[0]-0"
	Driver      "fglrx"
	Option	    "Monitor-DFP9" "0-DFP9"
	Option	    "Monitor-CRT1" "0-CRT1"
	BusID       "PCI:1:0:0"
EndSection

Section "Device"
	Identifier  "amdcccle-Device[1]-1"
	Driver      "fglrx"
	Option	    "Monitor-CRT1" "0-CRT1"
	BusID       "PCI:1:0:0"
	Screen      1
EndSection

Section "Screen"
	Identifier "aticonfig-Screen[0]-0"
	Device     "aticonfig-Device[0]-0"
	DefaultDepth     24
	SubSection "Display"
		Viewport   0 0
		Virtual   3360 1920
		Depth     24
	EndSubSection
EndSection

Section "Screen"
	Identifier "amdcccle-Screen[1]-1"
	Device     "amdcccle-Device[1]-1"
	DefaultDepth     24
	SubSection "Display"
		Viewport   0 0
		Depth     24
	EndSubSection
EndSection

ini WordPress的-W3TC-site.conf

wordpress-w3tc-site.conf
server {
    # Redirect yoursite.com to www.yoursite.com
    server_name         yoursite.com;
    rewrite ^(.*)       http://www.yoursite.com$1 permanent;
}

server {

    # Tell nginx to handle requests for the www.yoursite.com domain
    server_name         www.yoursite.com;
    index               index.php index.html index.htm;
    root                /srv/www/yoursite.com/public;
    access_log          /srv/www/yoursite.com/logs/access.log;
    error_log           /srv/www/yoursite.com/logs/error.log;

    # Use gzip compression
    # gzip_static       on;  # Uncomment if you compiled Nginx using --with-http_gzip_static_module
    gzip                on;
    gzip_disable        "msie6";
    gzip_vary           on;
    gzip_proxied        any;
    gzip_comp_level     5;
    gzip_buffers        16 8k;
    gzip_http_version   1.0;
    gzip_types          text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript image/png image/gif image/jpeg;
              
    # Rewrite minified CSS and JS files
    location ~* \.(css|js) {
        if (!-f $request_filename) {
            rewrite ^/wp-content/w3tc/min/(.+\.(css|js))$ /wp-content/w3tc/min/index.php?file=$1 last;
            # Use the following line instead for versions of W3TC pre-0.9.2.2
            # rewrite ^/wp-content/w3tc/min/([a-f0-9]+)\/(.+)\.(include(\-(footer|body))?(-nb)?)\.[0-9]+\.(css|js)$ /wp-content/w3tc/min/index.php?tt=$1&gg=$2&g=$3&t=$7 last;
        }
    }
            
    # Set a variable to work around the lack of nested conditionals
    set $cache_uri $request_uri;
    
    # POST requests and urls with a query string should always go to PHP
    if ($request_method = POST) {
        set $cache_uri 'no cache';
    }   
    if ($query_string != "") {
        set $cache_uri 'no cache';
    }   
    
    # Don't cache uris containing the following segments
    if ($request_uri ~* "(\/wp-admin\/|\/xmlrpc.php|\/wp-(app|cron|login|register|mail)\.php|wp-.*\.php|index\.php|wp\-comments\-popup\.php|wp\-links\-opml\.php|wp\-locations\.php)") {
        set $cache_uri "no cache";
    }
    
    # Don't use the cache for logged in users or recent commenters
    if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp\-postpass|wordpress_logged_in") {
        set $cache_uri 'no cache';
    }
    
    # Use cached or actual file if they exists, otherwise pass request to WordPress
    location / {
        try_files /wp-content/w3tc/pgcache/$cache_uri/_index.html $uri $uri/ /index.php?q=$uri&$args;
    }

    # Cache static files for as long as possible
    location ~* \.(xml|ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|rss|atom|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
        try_files       $uri =404;
        expires         max;
        access_log      off;
    }
    
    # Deny access to hidden files
    location ~* /\.ht {
        deny            all;
        access_log      off;
        log_not_found   off;
    }
    
    # Pass PHP scripts on to PHP-FPM
    location ~* \.php$ {
        try_files       $uri /index.php;
        fastcgi_index   index.php;
        fastcgi_pass    127.0.0.1:9000;
        include         fastcgi_params;
        fastcgi_param   SCRIPT_FILENAME    $document_root$fastcgi_script_name;
        fastcgi_param   SCRIPT_NAME        $fastcgi_script_name;
    }

}

ini 上帝配置

上帝配置

master.conf
#!/bin/bash
#
# god       Startup script for god (http://god.rubyforge.org)
#
# chkconfig: - 85 15
# description: God is an easy to configure, easy to extend monitoring \
#              framework written in Ruby.
#
 
CONF_DIR=/etc/god
GOD_BIN=/home/ubuntu/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/god-0.13.3/bin/god
RUBY_BIN=/home/ubuntu/.rbenv/shims/ruby
RETVAL=0
 
# Go no further if config directory is missing.
[ -d "$CONF_DIR" ] || exit 0
 
case "$1" in
    start)
      # Create pid directory
      $RUBY_BIN $GOD_BIN -c $CONF_DIR/master.conf
      RETVAL=$?
  ;;
    stop)
      $RUBY_BIN $GOD_BIN terminate
      RETVAL=$?
  ;;
    restart)
      $RUBY_BIN $GOD_BIN terminate
      $RUBY_BIN $GOD_BIN -c $CONF_DIR/master.conf
      RETVAL=$?
  ;;
    status)
      $RUBY_BIN $GOD_BIN status
      RETVAL=$?
  ;;
    *)
      echo "Usage: god {start|stop|restart|status}"
      exit 1
  ;;
esac
 
exit $RETVAL