{"id":158855,"date":"2012-11-15T23:54:03","date_gmt":"2012-11-15T19:54:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=158855"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=158855","title":{"rendered":"<span class=\"post_title\">\u0413\u0440\u0443\u043f\u043f\u043e\u0432\u0430\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0441\u0430\u0439\u0442\u043e\u0432 \u0447\u0435\u0440\u0435\u0437 git \u2014 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435\/\u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0441\u0430\u0439\u0442\u043e\u0432 \u0438\u0437 git-\u0431\u0440\u0430\u043d\u0447\u0435\u0439<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443, \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0433\u0440\u0443\u043f\u043f\u043e\u0432\u0443\u044e \u0441\u0440\u0435\u0434\u0443 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u0430\u0439\u0442\u043e\u0432 \u0447\u0435\u0440\u0435\u0437 git \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e git-\u0445\u0443\u043a\u043e\u0432. \u0421\u0442\u0430\u0442\u044c\u044f \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u043d\u0430 \u043d\u0430 \u043e\u043f\u044b\u0442\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u043e\u0432, \u044f \u043b\u0438\u0448\u044c \u043e\u043f\u0438\u0448\u0443 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c.<br \/>  \u041c\u043d\u043e\u0433\u043e\u0435 \u043d\u0430 \u044d\u0442\u0443 \u0442\u0435\u043c\u0443 \u0443\u0436\u0435 \u043e\u0431\u0441\u0443\u0436\u0434\u0430\u043b\u043e\u0441\u044c, \u0430 \u044f \u0434\u043e\u0431\u0430\u0432\u043b\u044e, \u043a\u0430\u043a \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0438\u043b\u0438 \u0443\u0434\u0430\u043b\u044f\u0442\u044c \u0441\u0430\u0439\u0442\u044b \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438\/\u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0438 \u0431\u0440\u0430\u043d\u0447\u0435\u0439 \u0432 git-\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438. \u0422\u0430\u043a\u0430\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u044c\u0441\u044f, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u0435\u0441\u043b\u0438 \u043d\u0430\u0434 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0447\u0430\u0441\u0442\u044f\u043c\u0438 \u0441\u0430\u0439\u0442\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0440\u0430\u0437\u043d\u044b\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u044b \u0438 \u043d\u0443\u0436\u043d\u044b \u0440\u0430\u0437\u043d\u044b\u0435 \u043f\u043b\u043e\u0449\u0430\u0434\u043a\u0438 (\u0431\u0440\u0430\u043d\u0447\u0438). \u041f\u043e\u0441\u043b\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f merge \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u0432\u0435\u0442\u043a\u0443, \u0430 \u0431\u0440\u0430\u043d\u0447\u0438 \u0438 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0435 \u0441\u0430\u0439\u0442\u044b \u0443\u0434\u0430\u043b\u044f\u044e\u0442\u0441\u044f \u0438\u043b\u0438 \u0430\u0440\u0445\u0438\u0432\u0438\u0440\u0443\u044e\u0442\u0441\u044f.<\/p>\n<p>  <a name=\"habracut\"><\/a><\/p>\n<p>  \u041a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442: \u043f\u043e-\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f master-\u0432\u0435\u0442\u043a\u0430, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0441\u0430\u0439\u0442. \u041f\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u044b \u0441\u043e\u0437\u0434\u0430\u044e\u0442 \u0431\u0440\u0430\u043d\u0447\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u0442\u0430\u043d\u043e\u0432\u044f\u0442\u0441\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 branchname.projectname.domain.ru. \u0412\u043d\u0435\u0441\u0435\u043d\u043d\u044b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0438 \u043c\u0435\u0440\u0436\u0430\u0442\u0441\u044f \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u0432\u0435\u0442\u043a\u0443 (\u0431\u0443\u0434\u044c \u0442\u043e master \u0438\u043b\u0438 \u043b\u044e\u0431\u0430\u044f \u0434\u0440\u0443\u0433\u0430\u044f). \u0410 \u0435\u0441\u043b\u0438 \u0431\u0440\u0430\u043d\u0447 \u0443\u0434\u0430\u043b\u0438\u0442\u044c, \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0443\u0434\u0430\u043b\u044f\u0435\u0442\u0441\u044f \u0438 \u043e\u0434\u043d\u043e\u0438\u043c\u0435\u043d\u043d\u044b\u0439 \u0441\u0430\u0439\u0442.<\/p>\n<h5>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 git<\/h5>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c git-\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439, \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c \u0435\u0433\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0441\u0442\u044c \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 <a href=\"http:\/\/factory.domain.ru\/git\/projectname\">factory.domain.ru\/git\/projectname<\/a> \u0438 \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e \u0431\u0435\u0437 \u043f\u0430\u0440\u043e\u043b\u044f \u0434\u043b\u044f IP, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441\u0435\u0440\u0432\u0435\u0440 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438. \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 git-\u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043d\u0435\u043e\u0434\u043d\u043e\u043a\u0440\u0430\u0442\u043d\u043e \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u043b\u0430\u0441\u044c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u0435\u0442\u0430\u043b\u0438 \u044d\u0442\u043e\u0433\u043e \u043f\u0443\u043d\u043a\u0442\u0430 \u044f \u043f\u0440\u043e\u043f\u0443\u0449\u0443.<\/p>\n<h5>\u0421\u043e\u0437\u0434\u0430\u0435\u043c git-\u0445\u0443\u043a\u0438<\/h5>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0444\u0430\u0439\u043b \/srv\/git\/projectname\/hooks\/post-update (\u044d\u0442\u043e\u0442 \u0441\u043a\u0440\u0438\u043f\u0442 \u0431\u0443\u0434\u0435\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c \u043a\u043e\u0434 \u043d\u0430 \u0441\u0430\u0439\u0442\u0435 \u043f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u0445 \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438; \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 PROJECT \u043d\u0430\u0437\u043d\u0430\u0447\u044c\u0442\u0435 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0430 \u0434\u043b\u044f GIT_URL \u2014 \u0441\u0441\u044b\u043b\u043a\u0443 \u043a git-\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044e):  <\/p>\n<pre><code class=\"bash\">#!\/bin\/sh  PATH=\/usr\/bin:\/bin:\/sbin:\/usr\/sbin:\/usr\/local\/bin:\/usr\/local\/sbin:$PATH PROJECT=&quot;projectname&quot; GIT_URL=&quot;http:\/\/factory.domain.ru\/git&quot;  git update-server-info  if [ ! -f $1 ]; then     exit 0 fi  while [ -n &quot;$1&quot; ] do     REF=`echo $1 | awk --field-separator=&quot;\/&quot; '{print $2}'`     if [ $REF = &quot;branches&quot; -o $REF = &quot;heads&quot; ]; then         BRANCH=`echo $1 | awk --field-separator=&quot;\/&quot; '{print $3}'`          if [ ! -d \/srv\/www\/$PROJECT\/repo\/master ]; then             mkdir -p \/srv\/www\/$PROJECT\/repo             GIT_SSL_NO_VERIFY=true git clone $GIT_URL\/$PROJECT \/srv\/www\/$PROJECT\/repo\/master         fi          if [ ! -d \/srv\/www\/$PROJECT\/repo\/$BRANCH ]; then             GIT_SSL_NO_VERIFY=true git clone -b $BRANCH $GIT_URL\/$PROJECT \/srv\/www\/$PROJECT\/repo\/$BRANCH         else             cd \/srv\/www\/$PROJECT\/repo\/$BRANCH             GIT_SSL_NO_VERIFY=true git fetch origin             GIT_SSL_NO_VERIFY=true git reset --hard origin\/$BRANCH             GIT_SSL_NO_VERIFY=true git clean -d -f             GIT_SSL_NO_VERIFY=true git checkout             GIT_SSL_NO_VERIFY=true git pull         fi     fi     shift done <\/code><\/pre>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0444\u0430\u0439\u043b \/srv\/git\/projectname\/hooks\/update (\u044d\u0442\u043e\u0442 \u0441\u043a\u0440\u0438\u043f\u0442 \u0431\u0443\u0434\u0435\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c\/\u0443\u0434\u0430\u043b\u044f\u0442\u044c \u0441\u0430\u0439\u0442\u044b \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438\/\u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0438 \u043d\u043e\u0432\u044b\u0445 \u0431\u0440\u0430\u043d\u0447\u0435\u0439; \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 PROJECT \u043d\u0430\u0437\u043d\u0430\u0447\u044c\u0442\u0435 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430):  <\/p>\n<pre><code class=\"bash\">#!\/bin\/sh  refname=&quot;$1&quot; oldrev=&quot;$2&quot; newrev=&quot;$3&quot;  PROJECT=&quot;projectname&quot;  # --- Safety check if [ -z &quot;$GIT_DIR&quot; ]; then         echo &quot;Don't run this script from the command line.&quot; &gt;&2         echo &quot; (if you want, you could supply GIT_DIR then run&quot; &gt;&2         echo &quot;  $0 &lt;ref&gt; &lt;oldrev&gt; &lt;newrev&gt;)&quot; &gt;&2         exit 1 fi  if [ -z &quot;$refname&quot; -o -z &quot;$oldrev&quot; -o -z &quot;$newrev&quot; ]; then         echo &quot;Usage: $0 &lt;ref&gt; &lt;oldrev&gt; &lt;newrev&gt;&quot; &gt;&2         exit 1 fi  # --- Check types # if $newrev is 0000...0000, it's a commit to delete a ref. zero=&quot;0000000000000000000000000000000000000000&quot; if [ &quot;$newrev&quot; = &quot;$zero&quot; ]; then         newrev_type=delete else         newrev_type=$(git cat-file -t $newrev) fi  BRANCH=`echo $1 | awk --field-separator=&quot;\/&quot; '{print $3}'`  delete () {     mv \/srv\/www\/$PROJECT\/repo\/$BRANCH \/srv\/www\/$PROJECT\/repo\/$BRANCH.removed_by_git     rm -rf \/srv\/www\/$PROJECT\/repo\/$BRANCH.removed_by_git }  case &quot;$refname&quot;,&quot;$newrev_type&quot; in         refs\/heads\/*,delete)                 # delete branch                 delete                 ;;         refs\/remotes\/*,delete)                 # delete tracking branch                 delete                 ;; esac  exit 0 <\/code><\/pre>\n<h5>\u041d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c nginx \u0438 apache \u0434\u043b\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u0434\u043e\u043c\u0435\u043d\u043e\u0432 branch.projectname.domain.ru<\/h5>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c vhost-\u043a\u043e\u043d\u0444\u0438\u0433 \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0435\u0433\u043e \u043a \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c\u0443 \u043a\u043e\u043d\u0444\u0438\u0433\u0443 nginx:  <\/p>\n<pre><code class=\"bash\">server {     listen 80;     # projectname \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u0435 \u043d\u0430 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0430 domain - \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0434\u043e\u043c\u0435\u043d\u0430. master-\u0432\u0435\u0442\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 projectname.domain.ru     server_name ~^(?P&lt;branch&gt;.*)\\.projectname\\.domain\\.ru$ projectname.domain.ru;      if ($branch = &quot;&quot;) {         set $branch &quot;master&quot;;     }      access_log \/srv\/www\/projectname\/logs\/projectname.domain.ru-acc main;     error_log \/srv\/www\/projectname\/logs\/projectname.domain.ru-err;              # \u041f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u043e\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0442\u0440\u0430\u0444\u0438\u043a\u0430 \u043d\u0430 apache mod_php     location \/ {         proxy_pass http:\/\/127.0.0.1:8080;         proxy_redirect off;         proxy_set_header Host $host;         proxy_set_header X-Real-IP $remote_addr;         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;         proxy_read_timeout 300;         client_max_body_size 256m;         proxy_buffer_size 16k;         proxy_buffers 32 16k;     }      # \u0417\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u043f\u0430\u043f\u043a\u0438 &quot;data&quot;, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 http:\/\/projectname.domain.ru\/data. \u0418\u0437 \u044d\u0442\u043e\u0439 \u043f\u0430\u043f\u043a\u0438 \u043e\u0442\u0434\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0430\u0442\u0438\u043a\u0430, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u044b \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0435 \u0444\u0430\u0439\u043b\u044b.     # \u042f \u0441\u0434\u0435\u043b\u0430\u043b, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u043f\u0438\u0441\u044c \u0447\u0435\u0440\u0435\u0437 php \u0431\u044b\u043b\u0430 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 data, \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c git-\u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u043e\u0432, \u0430 \u0442\u0430\u043a \u0436\u0435 \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u043e \u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u0432 \u043a\u043e\u0434\u0435.     # \u0415\u0441\u043b\u0438 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u043a\u043e\u0434\u0430 \u0441\u043b\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u0444\u0430\u0439\u043b\u043e\u0432 \u0432\u043d\u0435 DOCUMENT_ROOT, \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u0438\u043c\u043b\u0438\u043d\u043a \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0435\u0433\u043e \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439.     # \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043f\u0440\u0430\u0432\u0430 \u043d\u0430 \/srv\/www\/projectname\/data \u0434\u0435\u043b\u0430\u0435\u043c, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, apache:apache (\u0438\u043b\u0438 chmod 777), \u0430 \u043d\u0430 \/srv\/www\/projectname\/repo - username:username.     location ^~ \/data\/ {         root \/srv\/www\/projectname;     }      # \u0421\u0442\u0430\u0442\u0438\u043a\u0443 \u043e\u0442\u0434\u0430\u0435\u043c \u0432 \u043e\u0431\u0445\u043e\u0434 apache.     location ~* \\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|swf|flv|avi|djvu|mp3|mp4|ogv)$ {         root \/srv\/www\/projectname\/repo\/$branch\/htdocs;     }      # \u0417\u0430\u043f\u0440\u0435\u0449\u0430\u0435\u043c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043f\u0430\u043f\u043a\u0435 &quot;.git&quot;.     location ~ \/\\.git {         deny all;     }      # \u0415\u0441\u043b\u0438 \u043f\u043b\u043e\u0449\u0430\u0434\u043a\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u0430\u0439\u043b \/srv\/www\/robots.txt \u0441 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u044b\u043c, \u0437\u0430\u043f\u0440\u0435\u0449\u0430\u044e\u0449\u0438\u043c \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u0446\u0438\u044e \u0441\u0430\u0439\u0442\u0430 (\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0441\u0442\u0440\u043e\u043a \u0432 robots.txt \u043d\u0443\u0436\u043d\u043e \u0443\u0431\u0440\u0430\u0442\u044c):     # User-Agent: *     # Disallow: \/     # \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0432\u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u043e\u0433\u043e, \u0435\u0441\u0442\u044c \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 robots.txt \u0438\u043b\u0438 \u043d\u0435\u0442, \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u0438\u043a\u0438 \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0444\u0430\u0439\u043b \u0438\u0437 \/srv\/www, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0440\u0435\u0449\u0430\u0442\u044c \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u0446\u0438\u044e \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u0441\u0430\u0439\u0442\u0430.     location = \/robots.txt {         root \/srv\/www;     } } <\/code><\/pre>\n<p>  \u041e\u0441\u0442\u0430\u043b\u0441\u044f \u043b\u0438\u0448\u044c vhost-\u043a\u043e\u043d\u0444\u0438\u0433 \u0434\u043b\u044f apache:  <\/p>\n<pre><code class=\"bash\">&lt;VirtualHost *&gt;     # \u0425\u0430\u0440\u0434\u043a\u043e\u0434-\u0434\u043e\u043c\u0435\u043d \u0434\u043b\u044f master-\u0431\u0440\u0430\u043d\u0447\u0430     DocumentRoot \/srv\/www\/projectname\/repo\/master\/htdocs     ServerName projectname.domain.ru     ErrorLog \/srv\/www\/projectname\/logs\/projectname.domain.ru-err      &lt;Location \/&gt;         php_admin_value open_basedir &quot;\/usr\/share\/pear:\/srv\/www\/projectname:\/tmp&quot;         php_admin_value upload_tmp_dir &quot;\/srv\/www\/projectname\/tmp&quot;         php_admin_value session.save_path &quot;\/srv\/www\/projectname\/tmp&quot;         php_admin_value memory_limit &quot;256M&quot;         php_value post_max_size &quot;256M&quot;         php_value upload_max_filesize &quot;256M&quot;     &lt;\/Location&gt;      &lt;Directory \/srv\/www\/projectname\/repo&gt;         Options Includes FollowSymLinks MultiViews         AllowOverride All         Order allow,deny         Allow from all     &lt;\/Directory&gt; &lt;\/VirtualHost&gt;  &lt;VirtualHost *&gt;     # \u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f &quot;\u0431\u0440\u0430\u043d\u0447\u0435\u0439 \u043d\u0430 \u043b\u0435\u0442\u0443&quot; \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c VirtualDocumentRoot     # \u041f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 rewrite-\u043f\u0440\u0430\u0432\u0438\u043b \u0447\u0435\u0440\u0435\u0437 .htaccess \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 VirtualDocumentRoot \u043c\u043e\u0436\u0435\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0430 500, \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043c\u043e\u0447\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 &quot;RewriteBase \/&quot; \u0432 .htaccess.     VirtualDocumentRoot \/srv\/www\/projectname\/repo\/%1\/htdocs     ServerName dev.projectname.domain.ru     ServerAlias *.projectname.domain.ru     ErrorLog \/srv\/www\/projectname\/logs\/projectname.domain.ru-err      &lt;Location \/&gt;         php_admin_value open_basedir &quot;\/usr\/share\/pear:\/srv\/www\/projectname:\/tmp&quot;         php_admin_value upload_tmp_dir &quot;\/srv\/www\/projectname\/tmp&quot;         php_admin_value session.save_path &quot;\/srv\/www\/projectname\/tmp&quot;         php_admin_value memory_limit &quot;256M&quot;         php_value post_max_size &quot;256M&quot;         php_value upload_max_filesize &quot;256M&quot;     &lt;\/Location&gt;      &lt;Directory \/srv\/www\/projectname\/repo&gt;         Options Includes FollowSymLinks MultiViews         AllowOverride All         Order allow,deny         Allow from all     &lt;\/Directory&gt; &lt;\/VirtualHost&gt; <\/code><\/pre>\n<p>  \u0412\u043e\u0442 \u0438 \u0432\u0441\u0435! \u042d\u0442\u043e\u0442 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043a\u0440\u0443\u0442\u0438\u0442\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043a Redmine \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0435\u0432 \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043d\u043e\u0432\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432, \u0430 \u0442\u0430\u043a \u0436\u0435 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u0430\u0432\u0430\u043c\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430. \u0425\u043e\u0440\u043e\u0448\u0435\u0439 \u0438\u0434\u0435\u0435\u0439 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u043b\u0430\u0433\u0438\u043d \u0441 \u0440\u0430\u0437\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435\u043c \u043f\u0440\u0430\u0432 \u0434\u043e\u0441\u0442\u0443\u043f\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u0430\u0441\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0434\u0435\u043b\u0430\u0442\u044c \u0434\u0435\u043f\u043b\u043e\u0439 \u0438\u043b\u0438 \u0440\u043e\u043b\u043b\u0431\u0435\u043a \u043d\u0430 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d (\u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Capistrano).<\/p>\n<p>  \u041f\u043e\u0434\u043e\u0431\u043d\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u0440\u0435\u043a\u043b\u0430\u043c\u043d\u043e\u0433\u043e \u0430\u0433\u0435\u043d\u0442\u0441\u0442\u0432\u0430 \u0441\u043e \u0448\u0442\u0430\u0442\u043e\u043c \u0431\u043e\u043b\u044c\u0448\u0435 100 \u0447\u0435\u043b\u043e\u0432\u0435\u043a \u0438 \u0438\u043c \u043e\u0447\u0435\u043d\u044c \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f, \u0432\u0435\u0434\u044c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u044f \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0438, \u0434\u043e\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u0435 \u0437\u0430 \u0441\u0447\u0435\u0442 \u0447\u0435\u043b\u043e\u0432\u0435\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0444\u0430\u043a\u0442\u043e\u0440\u0430, \u0430 \u0433\u043b\u0430\u0432\u043d\u043e\u0435 \u2014 \u043d\u0435 \u043d\u0430\u0434\u043e \u043d\u043e\u0447\u044c\u044e \u0431\u0443\u0434\u0438\u0442\u044c \u0430\u0434\u043c\u0438\u043d\u0430, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u0441\u0440\u043e\u0447\u043d\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0438\u043b\u0438 \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u044b.<\/p>\n<p>  \u041f\u0438\u0448\u0438\u0442\u0435 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445, \u043a\u0430\u043a\u0438\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u043f\u043e \u044d\u0442\u043e\u0439 \u0442\u0435\u043c\u0435 \u0432\u0430\u043c \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b \u2014 \u0432 \u043d\u043e\u0432\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u043f\u0438\u0448\u0443!    \t   \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/158855\/\"> http:\/\/habrahabr.ru\/post\/158855\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443, \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0433\u0440\u0443\u043f\u043f\u043e\u0432\u0443\u044e \u0441\u0440\u0435\u0434\u0443 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u0430\u0439\u0442\u043e\u0432 \u0447\u0435\u0440\u0435\u0437 git \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e git-\u0445\u0443\u043a\u043e\u0432. \u0421\u0442\u0430\u0442\u044c\u044f \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u043d\u0430 \u043d\u0430 \u043e\u043f\u044b\u0442\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u043e\u0432, \u044f \u043b\u0438\u0448\u044c \u043e\u043f\u0438\u0448\u0443 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c.<br \/>  \u041c\u043d\u043e\u0433\u043e\u0435 \u043d\u0430 \u044d\u0442\u0443 \u0442\u0435\u043c\u0443 \u0443\u0436\u0435 \u043e\u0431\u0441\u0443\u0436\u0434\u0430\u043b\u043e\u0441\u044c, \u0430 \u044f \u0434\u043e\u0431\u0430\u0432\u043b\u044e, \u043a\u0430\u043a \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0438\u043b\u0438 \u0443\u0434\u0430\u043b\u044f\u0442\u044c \u0441\u0430\u0439\u0442\u044b \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438\/\u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0438 \u0431\u0440\u0430\u043d\u0447\u0435\u0439 \u0432 git-\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438. \u0422\u0430\u043a\u0430\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u044c\u0441\u044f, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u0435\u0441\u043b\u0438 \u043d\u0430\u0434 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0447\u0430\u0441\u0442\u044f\u043c\u0438 \u0441\u0430\u0439\u0442\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0440\u0430\u0437\u043d\u044b\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u044b \u0438 \u043d\u0443\u0436\u043d\u044b \u0440\u0430\u0437\u043d\u044b\u0435 \u043f\u043b\u043e\u0449\u0430\u0434\u043a\u0438 (\u0431\u0440\u0430\u043d\u0447\u0438). \u041f\u043e\u0441\u043b\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f merge \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u0432\u0435\u0442\u043a\u0443, \u0430 \u0431\u0440\u0430\u043d\u0447\u0438 \u0438 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0435 \u0441\u0430\u0439\u0442\u044b \u0443\u0434\u0430\u043b\u044f\u044e\u0442\u0441\u044f \u0438\u043b\u0438 \u0430\u0440\u0445\u0438\u0432\u0438\u0440\u0443\u044e\u0442\u0441\u044f.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-158855","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/158855","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=158855"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/158855\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=158855"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=158855"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=158855"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}