Webサーバー環境整備
パーミッションやオーナーを一括で変更する
qiita.com
CentOS 7 (5, 6) で "安定版 (最新版)" のNginxをインストールする方法
qiita.com
nginx
server { listen 80; server_name example.com; # root /opt/www; location / { index index.php index.html; } location ~ ^/subdir/(img|css|js|files)/(.+)$ { root /usr/share/nginx/example.com/subdir/app/webroot; try_files /$1/$2 =404; } # location ~ ^/(.*)/(.+\.php) { location ~ ^/(.*)/ { root /opt/www/$1/webroot; index index.php index.html; try_files /$2 /$2/ /index.php?$2&$args; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } # location ~ ^/(.*)/ { # root /opt/www/$1/webroot; # index index.php index.html; # try_files index.php; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; # include fastcgi_params; # } # 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; # } }
server { listen 80; server_name localhost; client_max_body_size 20M; #charset koi8-r; #access_log /var/log/nginx/log/host.access.log main; location / { #root /usr/share/nginx/html; root /opt/www; index index.html index.htm; } location ~ /(.*)/(img|css|js|files)/(.+)$ { root /opt/www/$1/webroot; try_files /$2/$3 =404; } # bad # success location ~ /(.*)/(.*)$ { root /opt/www; index index.php index.html; try_files /$1/$2 /$1/$2/ /$1/index.php?$2&$args; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_intercept_errors on; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } location ~ \.php$ { root /opt/www; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }
vimの設定
環境
OS:Ce ntOS7
vim:8.0
設定
~/.vimrcに下記のコードを追加する。
"--------------------------------------------------------------------------------- " プラグインのセットアップ "--------------------------------------------------------------------------------- if has('vim_starting') set nocompatible " Be iMproved " Required: set runtimepath+=~/.vim/bundle/neobundle.vim/ endif " Required: call neobundle#begin(expand('~/.vim/bundle/')) " Let NeoBundle manage NeoBundle " Required: NeoBundleFetch 'Shougo/neobundle.vim' "--------------------------------------------------------------------------------- " 各プラグインの設定は下記に "--------------------------------------------------------------------------------- "----------------------------------------------------------------------- " ファイルオープンを便利に "----------------------------------------------------------------------- NeoBundle 'Shougo/unite.vim' " Unite.vimで最近使ったファイルを表示できるようにする NeoBundle 'Shougo/neomru.vim' "----------------------------------------------------------------------- " Unit.vimの設定 "----------------------------------------------------------------------- " http://blog.remora.cx/2010/12/vim-ref-with-unite.html " 入力モードで開始する let g:unite_enable_start_insert=1 " バッファ一覧 noremap <C-P> :Unite buffer<CR> " ファイル一覧 noremap <C-N> :Unite -buffer-name=file file<CR> " 最近使ったファイルの一覧 noremap <C-Z> :Unite file_mru<CR> " sourcesを「今開いているファイルのディレクトリ」とする noremap :uff :<C-u>UniteWithBufferDir file -buffer-name=file<CR> " ウィンドウを分割して開く au FileType unite nnoremap <silent> <buffer> <expr> <C-J> unite#do_action('split') au FileType unite inoremap <silent> <buffer> <expr> <C-J> unite#do_action('split') " ウィンドウを縦に分割して開く au FileType unite nnoremap <silent> <buffer> <expr> <C-K> unite#do_action('vsplit') au FileType unite inoremap <silent> <buffer> <expr> <C-K> unite#do_action('vsplit') " ESCキーを2回押すと終了する au FileType unite nnoremap <silent> <buffer> <ESC><ESC> :q<CR> au FileType unite inoremap <silent> <buffer> <ESC><ESC> <ESC>:q<CR> "----------------------------------------------------------------------- " Gitを便利に使う "----------------------------------------------------------------------- NeoBundle 'tpope/vim-fugitive' " grep検索の実行後にQuickFix Listを表示する autocmd QuickFixCmdPost *grep* cwindow " ステータス行に現在のgitブランチを表示する set statusline+=%{fugitive#statusline()} "----------------------------------------------------------------------- " ファイルをtree表示してくれる*現在エラーで使用できない:w "----------------------------------------------------------------------- NeoBundle 'scrooloose/nerdtree' "----------------------------------------------------------------------- " ファイルオープンを便利に "----------------------------------------------------------------------- call neobundle#end() "----------------------------------------------------------------------- " Required: "----------------------------------------------------------------------- filetype plugin indent on " If there are uninstalled bundles found on startup, " this will conveniently prompt you to install them. NeoBundleCheck "--------------------------------------------------------------------------------- " 各種オプションの設定 "--------------------------------------------------------------------------------- " タグファイルの指定(でもタグジャンプは使ったことがない) set tags=~/.tags " スワップファイルは使わない(ときどき面倒な警告が出るだけで役に立ったことがない) set noswapfile " カーソルが何行目の何列目に置かれているかを表示する set ruler " コマンドラインに使われる画面上の行数 set cmdheight=2 " エディタウィンドウの末尾から2行目にステータスラインを常時表示させる set laststatus=2 " ステータス行に表示させる情報の指定(どこからかコピペしたので細かい意味はわかっていない) set statusline=%<%f\%m%r%h%w%{'['.(&fenc!=''?&fenc:&enc).']['.&ff.']'}%=%l,%c%V%8P " ステータス行に現在のgitブランチを表示する "set statusline+=%{fugitive#statusline()} " ウインドウのタイトルバーにファイルのパス情報等を表示する set title " コマンドラインモードで<Tab>キーによるファイル名補完を有効にする set wildmenu " 入力中のコマンドを表示する set showcmd " バックアップディレクトリの指定(でもバックアップは使ってない) set backupdir=$HOME/.vimbackup " バッファで開いているファイルのディレクトリでエクスクローラを開始する(でもエクスプローラって使ってない) set browsedir=buffer " 小文字のみで検索したときに大文字小文字を無視する set smartcase " 検索結果をハイライト表示する set hlsearch " 暗い背景色に合わせた配色にする "set background=dark set background=light " タブ入力を複数の空白入力に置き換える set expandtab " 検索ワードの最初の文字を入力した時点で検索を開始する set incsearch " 保存されていないファイルがあるときでも別のファイルを開けるようにする "set hidden " 不可視文字を表示する set list " タブと行の続きを可視化する set listchars=tab:>\ ,extends:< " 行番号を表示する set number highlight LineNr ctermfg=grey " 対応する括弧やブレースを表示する set showmatch " 改行時に前の行のインデントを継続する set autoindent " 改行時に入力された行の末尾に合わせて次の行のインデントを増減する set smartindent " タブ文字の表示幅 set tabstop=4 " Vimが挿入するインデントの幅 set shiftwidth=4 " 行頭の余白内で Tab を打ち込むと、'shiftwidth' の数だけインデントする set smarttab " カーソルを行頭、行末で止まらないようにする set whichwrap=b,s,h,l,<,>,[,] " 構文毎に文字色を変化させる syntax on " カラースキーマの指定 colorscheme desert " 行番号の色 highlight LineNr ctermfg=darkyellow " クリップボードの設定 "set clipboard=unnamed,autoselect set clipboard& set clipboard^=unnamedplus " インサートモードでjjと入力した場合はESCとみなす inoremap jj <Esc>