Link Search Menu Expand Document

Webserver Cheat Sheet

PHP

  • Setting up a PHP debugger
  • PHP - How to build Debian package for modules from PECL

    apt-get install dh-make-php
    dh-make-pecl <module name>
    cd <source directory>
    debuild
    # .deb package will be in ...
    
  • PHP - Manual module compiling

    # Ensure we see correct PHP
    export PATH=/usr/local/php5.7:$PATH
    cd <module source dir>
    phpize
    make
    sudo make install
    
  • PHP - PECL package management

    pecl list
    pecl list-files <name>
    pecl info <name>
    
    pecl install <name>
    pecl install <name>-<version>
    pecl uninstall <name>
    
    pecl list-upgrades
    pecl upgrade <name>
    

Rails

CDN

Misc

  • Alexa Pagerank API

    http://data.alexa.com/data?cli=10&url=$DOMAIN
    
  • DNS Prefetching HTML:

    # Turning it on/off globally
    <meta http-equiv="x-dns-prefetch-control" content="off">
    
    # Turning it on per-domain
    <link rel="dns-prefetch" href="http://www.spreadfirefox.com/">
    
  • Setting up HAProxy
  • Prevent out of ports on high traffic webserver due to FIN_WAIT and other issues:

    # Ensure to maximize available ports
    cat /proc/sys/net/ipv4/ip_local_port_range
    echo 1024 65535 >/proc/sys/net/ipv4/ip_local_port_range
    

    and set sockets to reuse

    # sysctl -p
    net.ipv4.tcp_tw_reuse = 1
    net.ipv4.tcp_tw_recycle = 1
    
  • gatling - HTTP stress testing
  • Jetty Tuning
    • Network sysctl settings
  • Start Rack Applications

    cd $ROOT
    rackup config.ru
    
  • Phusion Passenger

    passenger-status
    passenger-memory-stats
    
  • Squid - Quick Test Proxy Setup
  • Wordpress - Hardening Scanner wpscan
  • Determine redirect URLs

    curl -Ls -w %{url_effective} -o /dev/null <URL>
    
  • Favicon Standards
  • Favicon Generator / Checker