Gitlab 745 nginx Apache Configuration

Source: Internet
Author: User
Gitlab 7.4.5 Reference 1, 2 from the source installation.

In this paper, Gitlab 7.4.5 operating environment is shown in 3.

Nginx configuration Reference source comes with configuration Lib/support/nginx/gitlab

# # GitLab# # Maintainer: @randx### # Lines starting with a hashes (# #) is comments with information.# # Lines starting with one hash (#) is configuration parameters that can is uncommented.###################################### CHUNKED TRANSFER ####################################### # It's a known issue that git-over-http requires chunked transfer encoding [0]# # which is no supported by Nginx < 1.3.9 [1]. As a result, pushing a large object# # with Git (i.e. a large file) can leads to a 411 error. In theory can get# # Around this is tweaking this configuration file and either:# #-Installing an old version of Nginx with the Chunkin module [2] compiled in, or# #-Using a newer version of Nginx.### # at the time of writing we don't know if either of these theoretical solutions works.# # As a workaround users can use Git over SSH to push large files.### # [0] Https://git.kernel.org/cgit/git/git.git/tree/Documentation/technical/http-protocol.txt#n99# # [1] https://github.com/agentzh/chunkin-nginx-module#status# # [2] Https://github.com/agentzh/chunkin-nginx-module####################################### Configuration #######################################Upstream Gitlab {serverUnix:/home/git/gitlab/tmp/sockets/gitlab.socket fail_timeout=0;}# # Normal HTTP hostserver {#listen *:80 default_server;Listen *: theDefault_server; server_name mydomain.com;# Replace this with something like gitlab.example.comServer_tokensoff;# # Don ' t show the Nginx version number, a security best practiceRoot/home/git/gitlab/public;# # Increase this if you want to upload large attachments# # Or If you want to accept large git objects over HTTPClient_max_body_size -M# # Individual Nginx logs for this GitLab vhostAccess_log Logs/mydomain.gitlab_access.log;  Error_log Logs/mydomain.gitlab_error.log; Location/{# # Serve static files from defined root folder.# # @gitlab is a named location for the upstream fallback, see below.Try_files $uri $uri/index.html $uri. html@gitlab; }# # If a file, which is not found in the root folder is requested,# # Then the proxy passes the request to the Upsteam (Gitlab unicorn).Location@gitlab{# # If You use HTTPS Make sure disable gzip compression# # To is safe against BREACH attack.# gzip off;# # https://github.com/gitlabhq/gitlabhq/issues/694# # Some requests take more than seconds.Proxy_read_timeout -; Proxy_connect_timeout -; Proxy_redirectoff;    Proxy_set_header 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 X-forwarded-proto $scheme;    Proxy_set_header x-frame-options Sameorigin; Proxy_passhttp://giTlab; }# # Enable gzip compression as per Rails guide:# # Http://guides.rubyonrails.org/asset_pipeline.html#gzip-compression# # Warning:if You is using relative URLs remove the block below# See config/application.rb under ' Relative URL Support ' for the list of# # Other files this need to being changed for relative URL supportLocation ~ ^/(Assets)/{root/home/git/gitlab/public;#gzip_static on; # to serve pre-gzipped versionExpires Max;  Add_header Cache-control public; } error_page502/502.html;}

Apache
Apache (2.2.9) configuration references are tested on 6.0.0 gitlab.conf, and gitlab-8.0-apache2.2.conf tested on 8.0.0

########NameVirtualHost *:80#This configuration have been tested on GitLab 6.0.0 and GitLab 6.0.1#Note This config assumes unicorn are listening on default port 8080.#Module Dependencies# mod_rewrite# Mod_proxy# mod_proxy_http
    
 ServerNamemydomain.comserversignatureOffProxypreservehost on# Ensure that encoded slashes is not decoded and left in their encoded state.# Http://doc.gitlab.com/ce/api/projects.html#get-single-projectallowencodedslashesNodecode
    
 OrderDeny,allow AllowFrom AllProxypassreversehttp://127.0.0.1:9095Proxypassreversehttp://mydomain.com/#apache equivalent of nginx try files# Http://serverfault.com/questions/290784/what-is-apaches-equivalent-of-nginxs-try-files# Http://stackoverflow.com/questions/10954516/apache2-proxypass-for-rails-app-gitlabRewriteengine onRewritecond%{document_root}/%{request_filename}!-fRewriterule. * http://127.0.0.1:9095%{request_uri}[P,qsa,ne]# needed for downloading attachmentsDocumentRoot/home/git/gitlab/public#Set up Apache error documents, if back end goes down (i.e. 503 error) Then a Maintenance/deploy page is thrown up.
    ErrorDocument404/404.htmlErrorDocument422/422.htmlErrorDocument500/500.htmlErrorDocument503/deploy.htmlLogformat"%{x-forwarded-for}i%l%u%t \"%r\ "%>s%b"common_forwardederrorlogLogs/mydomain.gitlab_error.logCustomlogLogs/mydomain.gitlab_forwarded.log common_forwardedCustomlogLogs/mydomain.gitlab_access.log combined Env=!dontlogCustomlogLogs/mydomain.gitlab.log combined

Ps:
Configuration using the relative URL see gitlab 7.4.5 relative URL config

'). addclass (' pre-numbering '). Hide (); $ (this). addclass (' has-numbering '). Parent (). append ($numbering); for (i = 1; i <= lines; i++) {$numbering. Append ($ ('
  • '). Text (i)); }; $numbering. FadeIn (1700); }); });

    The above describes the Gitlab 745 nginx configuration, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • Related Article

    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.