Aapache .htaccess 重写URL

RewriteEngine On

RewriteCond %{HTTP_HOST} !^(www.+|localhost|127\.0\.0\.1|.+?\..+?\..+)$ [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php/$1 [QSA,L]

Nginx 创建虚拟主机BASH

#!/bin/bash

if [[ $# -lt 1 || $1 == "--help" || $1 == "-h" ]]
then
  echo "Usage:"
  echo "  sudo `basename $0` SITENAME"
  echo "Examples:"
  echo "  sudo `basename $0` drupal-8"
  exit
fi

WORKDIR="/home/zhouitpro/www"
APACHEDIR="/etc/nginx/sites-available"
APACHEENSITEDIR="/etc/nginx/sites-enabled"
HOSTSFILE="/etc/hosts"

echo "server {
    listen 80;
    root $WORKDIR/$1;
    server_name $1.localhost;
    location / {
        index index.php index.html index.htm;
    }
    location ~ \.php$ {
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        include fastcgi_params;
    }
    location ~ /\.ht {
        deny all;
    }
}" > $APACHEDIR/$1
sudo ln -s $APACHEDIR/$1 $APACHEENSITEDIR/$1
sudo /etc/init.d/nginx restart
grep -q "127.0.0.1  $1.localhost" $HOSTSFILE
if [ $? -ne 0 ]; then
  echo "127.0.0.1  $1.localhost" >> $HOSTSFILE
fi

Sublime 安装与配置

GIT插件安装:
https://github.com/kemayo/sublime-text-2-git/wiki

 

Drupal 插件安装:
https://github.com/robballou/drupal-sublimetext

 

package_control安装:
http://wbond.net/sublime_packages/package_control
https://github.com/wbond/sublime_package_control
http://wbond.net/sublime_packages/package_control/installation

 

快捷键操作:
http://docs.sublimetext.info/en/latest/reference/keyboard_shortcuts_win.html
CTRL+G 行跳转
ctrl+shift+p 调用命令
ctrl + ; 文件搜索
ctrl+D
ctrl+U 返回
ctrl+X 删除一行

 

sublime 配置:

https://github.com/andres-torres-marroquin/my-sublime-config

 

语言错误检测工具:

https://github.com/SublimeLinter/SublimeLinter

 

Indent Guides缩进提示插件

VPN更新密码脚本


#!/bin/bash                                                                                                                                                  
printf '' > '/var/www/ssh110.com/data/vpnuser'
printf '' > '/etc/ppp/chap-secrets'
users=('vpn01' 'vpn02' 'vpn03' 'vpn04' 'vpn05' 'vpn06' 'vpn07' 'vpn08' 'vpn09' 'vpn10' 'vpn11' 'vpn12' 'vpn13' 'vpn14' 'vpn15' 'vpn16' 'vpn17' 'vpn18' 'vpn19' 'vpn20')
echo zhouitpro pptpd zhouitpro123 '*' >> '/etc/ppp/chap-secrets'
echo cm pptpd 602000 '*' >> '/etc/ppp/chap-secrets'
echo qcc pptpd qcc123456 '*' >> '/etc/ppp/chap-secrets'
for u in ${users[@]}; do
    pawd=''
    a=('0' '1' '2' '3' '4' '5' '6' '7' '8' '9' 'a' 'b' 'c' 'z' 'A' 'B' 'Z')
    for i in {1..10}
    do
        pawd=$pawd${a[$RANDOM % ${#a[*]}]}
    done
    echo $u : $pawd >> '/var/www/ssh110.com/data/vpnuser'
    echo $u 'pptpd' $pawd '*' >> '/etc/ppp/chap-secrets'
done;


SSH更新用户密码 脚本


#!/bin/bash
printf '' > '/var/www/ssh110.com/data/userpasswd'
users=('ssh01' 'ssh02' 'ssh03' 'ssh04' 'ssh05' 'ssh06' 'ssh07' 'ssh08' 'ssh09' 'ssh10' 'ssh11' 'ssh12' 'ssh13' 'ssh14' 'ssh15' 'ssh16' 'ssh17' 'ssh18' 'ssh19' 'ssh20')
for u in ${users[@]}; do
    pawd=''
    a=('0' '1' '2' '3' '4' '5' '6' '7' '8' '9' 'a' 'b' 'c' 'z' 'A' 'B' 'Z')
    for i in {1..10}
    do
        pawd=$pawd${a[$RANDOM % ${#a[*]}]}
    done
    echo $u : $pawd >> '/var/www/ssh110.com/data/userpasswd'
    echo $u:$pawd | chpasswd
done;


Apache 创建虚拟主机脚本

depoly-site.sh

$sudo depoly-site.sh drupal
#!/bin/bash

if [[ $# -lt 1 || $1 == "--help" || $1 == "-h" ]]
then
  echo "Usage:"
  echo "  sudo `basename $0` SITENAME"
  echo "Examples:"
  echo "  sudo `basename $0` drupal-8"
  exit
fi

WORKDIR="/home/zhouitpro/www"
APACHEDIR="/etc/apache2/sites-available"
HOSTSFILE="/etc/hosts"

echo "
	ServerAlias $1.localhost
	DocumentRoot $WORKDIR/$1
	
		Options FollowSymLinks
		AllowOverride All
        
" > $APACHEDIR/$1
a2ensite $1
service apache2 restart
grep -q "127.0.0.1  $1.localhost" $HOSTSFILE
if [ $? -ne 0 ]; then
  echo "127.0.0.1  $1.localhost" >> $HOSTSFILE
fi

Drupal 常用模块安装

#!/bin/bash
 
enable_modules=('admin_menu' 'module_filter' 'token' 'ctools' 'pathauto' 'ds' 'devel' 'views' 'context')
disable_modules=('firephp' 'overlay' 'toolbar' 'color' 'dashboard')
 
for dmodule in ${disable_modules[@]}; do
    sudo drush pm-disable $dmodule -y
done
 
for emodule in ${enable_modules[@]}; do
   sudo drush dl $emodule -y
done;
 
for emodule in ${enable_modules[@]}; do
   sudo drush pm-enable $emodule -y
done;