您的当前位置:首页>全部文章>文章详情

搭建hg(mercurial)仓库

发表于:2019-08-15 18:27:41浏览:51次TAG:
### 安装 ```bash sudo apt-get install mercurial ``` ### 创建仓库 ```shell cd /home/hg hg init ``` ### 创建执行脚本 ```shell sudo vim hg.init ``` 写入如下内容 ```shell #!/sbin/sh # # Startup script for mercurial server. # # Change following ines APP_BIN=/usr/bin/hg SRC=/home/hg SRCNAME="hg_code" # Path to PID file of running mercurial process. PID_FILE=/var/run/hg.pid state=$1 case "$state" in 'start') echo "Mecurial Server service starting." (cd ${SRC} ;${APP_BIN} serve --name "${SRCNAME}" -d -p 8000 --pid-file ${PID_FILE}) ;; 'stop') if [ -f "${PID_FILE}" ]; then PID=`cat "${PID_FILE}"` if [ "${PID}" -gt 1 ]; then kill -TERM ${PID} echo "Stopping the Mercurial service PID=${PID}." else echo Bad PID for Mercurial -- \"${PID}\" fi else echo No PID file recorded for mercurial fi ;; *) echo "$0 {start|stop}" exit 1 ;; esac ``` ### 启动 ```bash sudo bash ./hg.init start ``` ### 停止 ```bash sudo bash ./hg.init stop ``` ### 搭配nginx ```shell upstream rc { server 127.0.0.1:8000; keepalive 600; } server { listen 80; listen 8088; server_name hg.com; location / { try_files $uri @rhode; } location @rhode { auth_basic "Hello!"; auth_basic_user_file htpasswd; proxy_pass http://rc; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Url-Scheme $scheme; proxy_set_header X-Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Proxy-host $proxy_host; client_max_body_size 50m; client_body_buffer_size 50m; proxy_buffering off; proxy_connect_timeout 3600; proxy_send_timeout 3600; proxy_read_timeout 3600; proxy_buffers 8 32k; } access_log /home/logs/nginx/hg.com/access.log; error_log /home/logs/nginx/hg.com/error.log; } ``` htpasswd 服务 请参考文章 [nginx用户认证配置(Basic HTTP authentication)](/index/article?id=13 "nginx用户认证配置(Basic HTTP authentication)")
栏目分类全部>
腾讯云采购季云服务器一折促销