快速安装gitea 1.11.1
添加Git用户
groupadd git
useradd git -g git -s /bin/false
更新Git,IUS源依赖EPEL源
yum install epel-release -y
rpm -Uvh https://centos7.iuscommunity.org/ius-release.rpm
yum remove git -y
yum install git2u -y
获取程序
mkdir -p /data/gitea /var/log/gitea
wget https://dl.gitea.io/gitea/1.11.1/gitea-1.11.1-linux-amd64.xz -O /data/gitea/gitea
chmod +x /data/gitea/gitea
chown -R git:git /data/gitea /var/log/gitea
添加为服务
vi /etc/systemd/system/gitea.service
内容为:
[Unit]
Description=Gitea (Git with a cup of tea)
After=syslog.target
After=network.target
#After=mysqld.service
#After=postgresql.service
#After=memcached.service
#After=redis.service
[Service]
# Modify these two values and uncomment them if you have
# repos with lots of files and get an HTTP error 500 because
# of that
###
#LimitMEMLOCK=infinity
#LimitNOFILE=65535
RestartSec=2s
Type=simple
User=git
Group=git
WorkingDirectory=/data/gitea
ExecStart=/data/gitea/gitea web
Restart=always
Environment=USER=git HOME=/data/gitea
[Install]
WantedBy=multi-user.target
启动服务
service gitea restart
chkconfig gitea on
nginx 代理示例
server {
listen 80;
server_name git.me.com;
rewrite ^(.*)$ https://git.me.com$1 permanent;
}
server
{
listen 443 ssl;
server_name git.me.com;
add_header Strict-Transport-Security "max-age=63072000; includeSubdomains; preload";
ssl_certificate /web/ssl/git.me.com_bundle.crt;
ssl_certificate_key /web/ssl/git.me.com.key;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 1440m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_session_tickets on;
### openssl rand -out session_ticket.key 48
ssl_session_ticket_key /web/ssl/session_ticket.key;
location / {
proxy_pass http://127.0.0.1/;
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;
}
}