centos6.6 installing the web version of Git--gogs

Source: Internet
Author: User
Tags install openssl

centos6.6 installation gogs

Reference Documents http://gogs.io/docs/installation

I'm using it. installed in a way that is managed by the package.

[Email protected] ~]# cat/etc/redhat-release CentOS release 6.6 (Final) [[email protected] ~]# Cat/etc/issuecentos Relea Se 6.6 (Final) Kernel \ r on an \m [[email protected] ~]# uname-alinux yy 2.6.32-504.el6.x86_64 #1 SMP Wed Oct 15 04:27:16 UTC x86_64 x86_64 x86_64 gnu/linux[[email protected] ~]# uname-r2.6.32-504.el6.x86_64


gogs Span style= "font-family: ' Times New Roman ';" >yum warehouse

[[Email protected] ~]# rpm--import https://rpm.packager.io/key[[email protected] ~]# echo "[gogs]> name=repository fo R pkgr/gogs application.> baseurl=https://rpm.packager.io/gh/pkgr/gogs/centos6/pkgr> enabled=1 "| sudo tee/etc/yum.repos.d/gogs.repo[gogs]name=repository for pkgr/gogs application.baseurl=https://rpm.packager.io/ Gh/pkgr/gogs/centos6/pkgrenabled=1[[email protected] ~]# [[email protected] ~]# Cat/etc/yum.repos.d/gogs.repo [Gogs] Name=repository for Pkgr/gogs application.baseurl=https://rpm.packager.io/gh/pkgr/gogs/centos6/pkgrenabled=1


2. installing gogs

[email protected] ~]# Yum install gogs-y


3. Configure temporary variables

App_name= "Gogs" mysql_password= "123456789" hostname= "www.yuanyang.com"


4. install mysql

[[email protected] ~]# yum install mysql-server-y[[email protected] ~]# service mysqld restart[[email protected] ~]# CHKC Onfig Mysqld[[email protected] ~]# chkconfig--list mysqldmysqld 0: Off 1: Off 2: Off 3: Off 4: off 5: off 6: Off


5. Configure mysql

[Email protected] ~]# mysqladmin-u root password "ABCabc123" [[email protected] ~]# mysql-u root-pabcabc123 mysql> C reate DATABASE IF not EXISTS gogs; Query OK, 1 row Affected (0.00 sec) mysql> use gogs;database changed mysql> set global storage_engine=innodb; Query OK, 0 rows Affected (0.00 sec)


6. Installing and configuring Apache

The official website is installed Nginx , because I here network reason, and the server itself has an Apache, so use Apache to do.

The Gogs itself is Web -enabled, and the port defaults to + , We use the Apache Reverse proxy function, Access using the port .

[email protected] tools]# Yum install-y httpd httpd-devel

[Email protected] tools]# vim/etc/httpd/conf/httpd.conf

At the end of the configuration file add the following content, specifically, according to their own circumstances to modify.

<VirtualHost *:80>        ServerAdmin [email  protected]         serveralias www.abc.com         ProxyPreserveHost On         proxyrequests off         <proxy *>                 adddefaultcharset off                 Order  deny,allow                 allow from all        </proxy>          ProxyPass / http://127.0.0.1:3000/         proxypassreverse / http://127.0.0.1:3000/         errorlog /etc/ Httpd/logs/error.log        customlog /etc/httpd/logs/access.log  combined</VirtualHost>


Launch Apache

[Email protected] logs]# service httpd restart


Check if ports and services are started

[[email protected] logs]# lsof -i tcp:3000command  pid user    FD   TYPE DEVICE SIZE/OFF NODE NAMEgogs     2886 gogs    4u  ipv6  20047       0t0  tcp *:hbci  (LISTEN) [[Email protected] logs]# lsof -i tcp :80command  pid   user   fd   type device  size/off node namehttpd   3545   root    4u   IPv6  25412      0t0  TCP *:http  (LISTEN) httpd   3547 apache    4u  ipv6  25412       0t0  TCP *:http  (LISTEN) Httpd   3548 apache     4u  ipv6  25412      0t0  tcp *:http  (LISTEN) httpd   3549 apache    4u  ipv6  25412       0t0  TCP *:http  (LISTEN) Httpd   3550 apache     4u  IPv6  25412      0t0   tcp *:http  (LISTEN) Httpd   3551 apache    4u  ipv6   25412      0t0  TCP *:http  (LISTEN) httpd    3552 apache    4u  IPv6  25412       0t0  TCP *:http  (LISTEN) httpd   3553 apache     4u  ipv6  25412      0t0  tcp  *:http  (LISTEN) Httpd   3554 apache    4u  ipv6  25412       0t0  TCP *:http  (LISTEN) Httpd   3555 apache     4u  IPv6  25412      0t0   tcp *:http  (LISTEN)


Close the waterproofing wall and SELinux

[[Email protected] logs]# service iptablers stop[[email protected] logs]# Setenforce 0


Once configured here, enter http://you_ipaddress in the browser to access the

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/73/56/wKiom1X6bHzj-Rc2AACLR5H7hlo018.jpg "title=" 1.png " alt= "Wkiom1x6bhzj-rc2aaclr5h7hlo018.jpg"/>

7. Configure Apache to access gogs using HTTPS

[email protected] logs]# Yum install OpenSSL mod_ssl-y


See if these three files were generated

[Email protected] conf.d]# Ls/etc/pki/tls/certs/localhost.crt/etc/pki/tls/certs/localhost.crt[[email protected] conf.d]# Ls/etc/pki/tls/private/localhost.key/etc/pki/tls/private/localhost.key[[email protected] conf.d]# ls/etc/ Httpd/conf.d/ssl.conf/etc/httpd/conf.d/ssl.conf


[Email protected] conf.d]# vim/etc/httpd/conf.d/ssl.conf


Modify the SSL configuration file in the final </VirtualHost> before adding the following content

Proxypass/git http://127.0.0.1:3000ProxyPassReverse/git Http://127.0.0.1:3000<Location/git>Order Allow, Denyallow from All</location>


8. Modify the gogs configuration file

[[email protected] conf.d]# cd/opt/gogs/custom/conf/[[email protected] conf]# Lsapp.ini[[email protected] conf]# CP app. INI app.ini.back[[email protected] conf]# vim App.ini


Modifying a configuration file

Find domain = localhostand change it to domain = 172.16.1.231 ( IP or domain name of the server ) )

Root_url =% (PROTOCOL) s://% (DOMAIN) s:% (http_port) s/ This line is preceded by a # comment out.

and change into

Root_url = Https://172.16.1.231/git If you have a domain name, change that IP to a domain .

Such as:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/73/53/wKioL1X6bsGyc3lmAACQTIb_4Ak030.jpg "title=" 2.png " alt= "Wkiol1x6bsgyc3lmaacqtib_4ak030.jpg"/>


Restart gogs and Apache

[Email protected] conf]#/etc/init.d/gogs Restartthis job runs via upstart, invoking upstart Now...gogs Start/running[[em AIL protected] conf]# service httpd restart
 stop  httpd:                                                  [OK] starting  httpd:httpd: apr_sockaddr_info_get ()  failed for yyhttpd:  Could not reliably determine the server ' s fully qualified domain  name, using 127.0.0.1 for servername                                                              [OK] 


Access gogs using https://you_ipaddress/git

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/73/56/wKiom1X6bJeAEMh_AACmK1mUIQI348.jpg "title=" 3.png " alt= "Wkiom1x6bjeaemh_aacmk1muiqi348.jpg"/>

Now you can follow the installation Wizard to complete your Web version of GIT gogs configuration.


This article is from the "Dandelion Secret" blog, please be sure to keep this source http://yylinfan.blog.51cto.com/8670422/1695714

centos6.6 installing the web version of Git--gogs

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.