{"id":1028,"date":"2017-02-26T12:31:27","date_gmt":"2017-02-26T03:31:27","guid":{"rendered":"https:\/\/takumi9942.net\/blog\/?p=1028"},"modified":"2024-09-15T14:48:31","modified_gmt":"2024-09-15T05:48:31","slug":"how-to-install-gitlab-to-subdir-with-nginx","status":"publish","type":"post","link":"https:\/\/takumi9942.net\/blog\/?p=1028","title":{"rendered":"\u3010Conoha\u3011Nginx\u306e\u30ea\u30d0\u30fc\u30b9\u30d7\u30ed\u30ad\u30b7\u3092\u5229\u7528\u3057\u3066GitLab\u3092\u30b5\u30d6\u30c9\u30e1\u30a4\u30f3\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u307f\u305f"},"content":{"rendered":"<p>\u4eca\u56de\u306fGitHub\u306e\u3088\u3046\u306a\u30ea\u30e2\u30fc\u30c8\u30ec\u30dd\u30b8\u30c8\u30ea\u3092\u7ba1\u7406\u3067\u304d\u308bGitLab\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u307f\u307e\u3057\u305f\u3002<br \/>\n\u305d\u306e\u307e\u307e\u3060\u3068\u4e0d\u4fbf\u306a\u306e\u3067\u3001\u4ed6\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3068\u4e21\u7acb\u3067\u304d\u308b\u3088\u3046\u306b\u30ea\u30d0\u30fc\u30b9\u30d7\u30ed\u30ad\u30b7\u3092\u5229\u7528\u3057\u3066\u30b5\u30d6\u30c9\u30e1\u30a4\u30f3\u3067\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u307e\u3057\u305f\u3002<br \/>\n<!--more--><\/p>\n<p>0.\u307e\u305aGitLab\u306e\u52d5\u4f5c\u306b\u5fc5\u8981\u306a\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002Conoha\u306eCentOS7.3\u3067\u306f\u3059\u3079\u3066\u5c0e\u5165\u6e08\u307f\u3067\u3057\u305f\u306e\u3067\u30b9\u30ad\u30c3\u30d7\u3057\u307e\u3059\u3002<\/p>\n<pre>yum install curl policycoreutils openssh-server openssh-clients\r\nsystemctl enable sshd\r\nsystemctl start sshd\r\nyum install postfix\r\nsystemctl enable postfix\r\nsystemctl start postfix\r\nfirewall-cmd --permanent --add-service=http\r\nsystemctl reload firewalld\r\n<\/pre>\n<p>1.GitLab\u306e\u6700\u65b0\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<\/p>\n<pre>curl -sS https:\/\/packages.gitlab.com\/install\/repositories\/gitlab\/gitlab-ce\/script.rpm.sh | sudo bash\r\nsudo yum install gitlab-ce\r\n<\/pre>\n<p>2.GitLab\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u30ea\u30d0\u30fc\u30b9\u30d7\u30ed\u30ad\u30b7\u7528\u306b\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<pre>vim \/etc\/gitlab\/gitlab.rb\r\n\r\n#\u4ee5\u4e0b\u306e\u884c\u3092\u305d\u308c\u305e\u308c\u691c\u7d22\u3057\u3066\u7de8\u96c6\r\nexternal_url 'https:\/\/GitLab\u306eURL'\r\nnginx['listen_port'] = \u4efb\u610f\u306e\u30dd\u30fc\u30c8\u756a\u53f7\r\nnginx['listen_https'] = false\r\n<\/pre>\n<p>3.Nginx\u3067GitLab\u3078\u30ea\u30d0\u30fc\u30b9\u30d7\u30ed\u30ad\u30b7\u3092\u8a2d\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<pre>vim \/etc\/nginx\/conf.d\/gitlab.conf\r\n\r\n#\u4efb\u610f\u306eServer\u306e\u4e2d\u306b\u4ee5\u4e0b\u3092\u8a18\u8ff0\r\nlocation \/ {\r\n    proxy_set_header Host $host;\r\n    proxy_set_header X-Real-IP $remote_addr;\r\n    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\r\n    proxy_set_header X-Forwarded-Proto $scheme;\r\n    proxy_set_header X-Forwarded-Ssl on;\r\n    proxy_pass http:\/\/127.0.0.1:\u4e0a\u8a18\u3067\u8a2d\u5b9a\u3057\u305f\u30dd\u30fc\u30c8\u756a\u53f7;\r\n}\r\n<\/pre>\n<p>4.GitLab\u306b\u8a2d\u5b9a\u3092\u53cd\u6620\u3055\u305b\u307e\u3059\u3002<\/p>\n<pre>gitlab-ctl reconfigure\r\n<\/pre>\n<p>5.Nginx\u3092\u518d\u8d77\u52d5\u3057\u307e\u3059<\/p>\n<pre>systemctl restart nginx\r\n<\/pre>\n<p>6.\u624b\u98063\u306eserver_name\u3067\u6307\u5b9a\u3057\u305fURL\u306b\u30d6\u30e9\u30a6\u30b6\u3067\u30a2\u30af\u30bb\u30b9\u3057\u307e\u3059<\/p>\n<p>7.\u4ee5\u4e0b\u306e\u753b\u9762\u304c\u8868\u793a\u3055\u308c\u305f\u3089\u3001\u7ba1\u7406\u30a2\u30ab\u30a6\u30f3\u30c8\u306e\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u5165\u529b\u3057\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/takumi9942.net\/blog\/wp-content\/uploads\/2017\/02\/g1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1035\" src=\"https:\/\/takumi9942.net\/blog\/wp-content\/uploads\/2017\/02\/g1.png\" alt=\"\" width=\"928\" height=\"525\" srcset=\"https:\/\/takumi9942.net\/blog\/wp-content\/uploads\/2017\/02\/g1.png 928w, https:\/\/takumi9942.net\/blog\/wp-content\/uploads\/2017\/02\/g1-300x170.png 300w, https:\/\/takumi9942.net\/blog\/wp-content\/uploads\/2017\/02\/g1-768x434.png 768w, https:\/\/takumi9942.net\/blog\/wp-content\/uploads\/2017\/02\/g1-600x339.png 600w\" sizes=\"auto, (max-width: 928px) 100vw, 928px\" \/><\/a><\/p>\n<p>8.\u30ed\u30b0\u30a4\u30f3\u753b\u9762\u306b\u79fb\u52d5\u3059\u308b\u306e\u3067\u3001\u30e6\u30fc\u30b6\u30fc\u540d\u300croot\u300d\u3068\u5148\u307b\u3069\u8a2d\u5b9a\u3057\u305f\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u5165\u529b\u3057\u3066\u30ed\u30b0\u30a4\u30f3\u3057\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/takumi9942.net\/blog\/wp-content\/uploads\/2017\/02\/g2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1036\" src=\"https:\/\/takumi9942.net\/blog\/wp-content\/uploads\/2017\/02\/g2.png\" alt=\"\" width=\"933\" height=\"515\" srcset=\"https:\/\/takumi9942.net\/blog\/wp-content\/uploads\/2017\/02\/g2.png 933w, https:\/\/takumi9942.net\/blog\/wp-content\/uploads\/2017\/02\/g2-300x166.png 300w, https:\/\/takumi9942.net\/blog\/wp-content\/uploads\/2017\/02\/g2-768x424.png 768w, https:\/\/takumi9942.net\/blog\/wp-content\/uploads\/2017\/02\/g2-600x331.png 600w\" sizes=\"auto, (max-width: 933px) 100vw, 933px\" \/><\/a><\/p>\n<p>\u4ee5\u4e0a\u3067\u5c0e\u5165\u306f\u5b8c\u4e86\u3067\u3059\u3002<br \/>\n\u4e00\u898b\u7c21\u5358\u306b\u898b\u3048\u307e\u3059\u304c\u3001root\u306e\u30d1\u30b9\u30ef\u30fc\u30c9\u753b\u9762\u3092\u51fa\u3059\u306e\u306b\u7d50\u69cb\u82e6\u6226\u3057\u307e\u3057\u305f(;\u00b4\u0434\uff40)\uff84\uff8e\uff8e\u2026<\/p>\n","protected":false},"excerpt":{"rendered":"\u4eca\u56de\u306fGitHub\u306e\u3088\u3046\u306a\u30ea\u30e2\u30fc\u30c8\u30ec\u30dd\u30b8\u30c8\u30ea\u3092\u7ba1\u7406\u3067\u304d\u308bGitLab\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u307f\u307e\u3057\u305f\u3002 \u305d\u306e\u307e\u307e\u3060\u3068\u4e0d\u4fbf\u306a\u306e\u3067\u3001\u4ed6\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3068\u4e21\u7acb\u3067\u304d\u308b\u3088\u3046\u306b\u30ea\u30d0\u30fc\u30b9\u30d7\u30ed\u30ad\u30b7\u3092\u5229\u7528\u3057\u3066\u30b5\u30d6\u30c9\u30e1\u30a4\u30f3\u3067\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u3088\u3046\u306b&hellip;","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"csco_display_header_overlay":false,"csco_singular_sidebar":"","csco_page_header_type":"","csco_page_load_nextpost":"","csco_post_video_location":[],"csco_post_video_location_hash":"","csco_post_video_url":"","csco_post_video_bg_start_time":0,"csco_post_video_bg_end_time":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[14],"tags":[],"class_list":{"0":"post-1028","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-conoha","7":"cs-entry","8":"cs-video-wrap"},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/takumi9942.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1028","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/takumi9942.net\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/takumi9942.net\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/takumi9942.net\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/takumi9942.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1028"}],"version-history":[{"count":1,"href":"https:\/\/takumi9942.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1028\/revisions"}],"predecessor-version":[{"id":2562,"href":"https:\/\/takumi9942.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1028\/revisions\/2562"}],"wp:attachment":[{"href":"https:\/\/takumi9942.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1028"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/takumi9942.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1028"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/takumi9942.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1028"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}