如何在mac下使用ll命令

在当前用户目录下创建一个 .bash_profile 文件,记住前面要有点
如果不知道当前目录在哪里,则:

cd ~

.bash_profile文件内容为

alias ll=’ls -lG’

mac vim 语法高亮

第一步:将配置文件copy到当前用户目录下,joe为当前用户名

cp /usr/share/vim/vimrc ~joe/.vimrc

第二步:编辑.vimrc文件,再文件最后加上

syntax on

附Linux默认的.vimrc配置

" An example for a vimrc file.
"
" Maintainer:	Bram Moolenaar <Bram@vim.org>
" Last change:	2008 Jul 02
"
" To use it, copy it to
"     for Unix and OS/2:  ~/.vimrc
"	      for Amiga:  s:.vimrc
"  for MS-DOS and Win32:  $VIM_vimrc
"	    for OpenVMS:  sys$login:.vimrc

" When started as "evim", evim.vim will already have done these settings.
if v:progname =~? "evim"
  finish
endif

" Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible

" allow backspacing over everything in insert mode
set backspace=indent,eol,start

if has("vms")
  set nobackup		" do not keep a backup file, use versions instead
else
  set backup		" keep a backup file
endif
set history=50		" keep 50 lines of command line history
set ruler		" show the cursor position all the time
set showcmd		" display incomplete commands
set incsearch		" do incremental searching

" For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries
" let &guioptions = substitute(&guioptions, "t", "", "g")

" Don't use Ex mode, use Q for formatting
map Q gq

" CTRL-U in insert mode deletes a lot.  Use CTRL-G u to first break undo,
" so that you can undo CTRL-U after inserting a line break.
inoremap <C-U> <C-G>u<C-U>

" In many terminal emulators the mouse works just fine, thus enable it.
if has('mouse')
  set mouse=a
endif

" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
  syntax on
  set hlsearch
endif

" Only do this part when compiled with support for autocommands.
if has("autocmd")

  " Enable file type detection.
  " Use the default filetype settings, so that mail gets 'tw' set to 72,
  " 'cindent' is on in C files, etc.
  " Also load indent files, to automatically do language-dependent indenting.
  filetype plugin indent on

  " Put these in an autocmd group, so that we can delete them easily.
  augroup vimrcEx
  au!

  " For all text files set 'textwidth' to 78 characters.
  autocmd FileType text setlocal textwidth=78

  " When editing a file, always jump to the last known cursor position.
  " Don't do it when the position is invalid or when inside an event handler
  " (happens when dropping a file on gvim).
  " Also don't do it when the mark is in the first line, that is the default
  " position when opening a file.
  autocmd BufReadPost *
     if line("'"") > 1 && line("'"") <= line("$") |
       exe "normal! g`"" |
     endif

  augroup END

else

  set autoindent		" always set autoindenting on

endif " has("autocmd")

" Convenient command to see the difference between the current buffer and the
" file it was loaded from, thus the changes you made.
" Only define it when not defined already.
if !exists(":DiffOrig")
  command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis
		   | wincmd p | diffthis
endif

VirtualBox nginx缓存?真?假?nginx js缓存

VirtualBox虚拟机上安装的nginx存在一个问题,就是修改服务器上的js文件后访问发现不生效,甚至导致错误
很久之前我就碰到这个问题

缘由:
修改js后访问未生效
因为是从别的站点扒下来的模板第一反应以为是js被加密了,搞了很久未果,放弃
后来又一次用这套模板发现js修改不生效的问题又没了,遂断定,非js加密

后经过测试发现安装在苹果上的apche没有这个问题
而安装在VirtualBox上的nginx存在这个问题
遂怀疑是nginx服务器缓存问题

然后baidu各种搜索禁用nginx缓存未果。。。。

又过了N天,又是这问题,于是Google一下关键词 “virtualbox nginx js cache”
发现老外也碰到这问题了
77B412FD-E81A-4CF3-9B70-CDB3C18132EC
详见 http://serverfault.com/questions/269420/disable-caching-when-serving-static-files-with-nginx-for-development
原来是VirtualBox缓存问题
方法一:
老外有一个解决办法见 http://abitwiser.wordpress.com/2011/02/24/virtualbox-hates-sendfile/

方法二:
考虑到Mac上安装php且支持oracle mysql pdo 等各种组件会比较麻烦
所以折中办法是,在Mac苹果机上仅安装 nginx,而所有php请求转发到VirtualBox的虚拟机上
参考 http://blog.xxtime.com/960

nginx转发php请求到其他服务器

例如:服务器A转发php请求到服务器B

以下为A服务器修改

location ~ .php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}

修改下ip即可,改成PHP服务器的IP

location ~ .php$ {
fastcgi_pass 192.168.4.3:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}

以下为目标服务器配置(B服务器,即PHP服务器)

首先开启B服务器的端口 修改/etc/sysconfig/iptables增加一行
-A INPUT -m state --state NEW -m tcp -p tcp --dport 9000 -j ACCEPT

配置php-fpm文件
yum安装的通常在 /etc/php-fpm.d/www.conf,编译安装的通常在/usr/local/php/etc/php-fpm.conf

修改:
listen = 127.0.0.1:9000
改成
listen = 0.0.0.0:9000

修改
listen.allowed_clients = 127.0.0.1
添加允许的服务器,如本例中另外增加了两台服务器
listen.allowed_clients = 127.0.0.1,192.168.4.3,192.168.4.127
也可以注释掉 listen.allowed_clients 配置,因为默认允许任何机器连接,没有IP限制

注意: nginx服务器与php服务器两台的目录部署应该一致,否则会404错误找不到文件 “File not found.”