Skip to content

Commit 21a4cbe

Browse files
authored
Merge pull request #3064 from kkimurak/use-official-nginx-repo
Use official nginx repository to install nginx
2 parents c079996 + 928fc10 commit 21a4cbe

File tree

5 files changed

+15
-12
lines changed

5 files changed

+15
-12
lines changed

Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ RUN set -ex && \
4040
&& echo 'deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main' > /etc/apt/sources.list.d/nodesource.list \
4141
&& wget --quiet -O - https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor -o /etc/apt/keyrings/yarn.gpg \
4242
&& echo 'deb [signed-by=/etc/apt/keyrings/yarn.gpg] https://dl.yarnpkg.com/debian/ stable main' > /etc/apt/sources.list.d/yarn.list \
43+
&& wget --quiet -O - https://nginx.org/keys/nginx_signing.key | gpg --dearmor -o /etc/apt/keyrings/nginx-archive-keyring.gpg \
44+
&& echo "deb [signed-by=/etc/apt/keyrings/nginx-archive-keyring.gpg] http://nginx.org/packages/ubuntu jammy nginx" >> /etc/apt/sources.list.d/nginx.list \
45+
&& printf "Package: *\nPin: origin nginx.org\nPin: release o=nginx\nPin-Priority: 900\n" >> /etc/apt/preferences.d/99nginx \
4346
&& set -ex \
4447
&& apt-get update \
4548
&& DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
@@ -55,7 +58,7 @@ RUN set -ex && \
5558
&& update-locale LANG=C.UTF-8 LC_MESSAGES=POSIX \
5659
&& locale-gen en_US.UTF-8 \
5760
&& DEBIAN_FRONTEND=noninteractive dpkg-reconfigure locales \
58-
&& rm -rf /var/lib/apt/lists/*
61+
&& rm -rf /var/lib/apt/lists/* /etc/nginx/conf.d/default.conf
5962

6063
COPY assets/build/ ${GITLAB_BUILD_DIR}/
6164
RUN bash ${GITLAB_BUILD_DIR}/install.sh

assets/runtime/config/nginx/gitlab

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ map $request_uri $obfuscated_request_uri {
3030
~(.+\?)(.*&)?(private_token=|access_token=)[^&]*(&.*|$) $1$2$3****$4;
3131
default $request_uri;
3232
}
33-
log_format main '$remote_addr - $remote_user [$time_local] '
33+
log_format gitlab_access '$remote_addr - $remote_user [$time_local] '
3434
'"$request_method $obfuscated_request_uri $server_protocol" $status $body_bytes_sent '
3535
'"$http_referer" "$http_user_agent"';
3636

@@ -58,7 +58,7 @@ server {
5858
add_header Strict-Transport-Security "max-age={{NGINX_HSTS_MAXAGE}};";
5959

6060
## Individual nginx logs for this GitLab vhost
61-
access_log {{GITLAB_LOG_DIR}}/nginx/gitlab_access.log main;
61+
access_log {{GITLAB_LOG_DIR}}/nginx/gitlab_access.log gitlab_access;
6262
error_log {{GITLAB_LOG_DIR}}/nginx/gitlab_error.log;
6363

6464
location / {

assets/runtime/config/nginx/gitlab-registry

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ server {
1111
server_name {{GITLAB_REGISTRY_HOST}};
1212
server_tokens off; ## Don't show the nginx version number, a security best practice
1313
return 301 https://$http_host:$request_uri;
14-
access_log {{GITLAB_LOG_DIR}}/nginx/gitlab_registry_access.log;
14+
access_log {{GITLAB_LOG_DIR}}/nginx/gitlab_registry_access.log gitlab_access;
1515
error_log {{GITLAB_LOG_DIR}}/nginx/gitlab_registry_error.log;
1616
}
1717

@@ -36,7 +36,7 @@ server {
3636
ssl_session_cache builtin:1000 shared:SSL:10m;
3737
ssl_session_timeout 5m;
3838

39-
access_log {{GITLAB_LOG_DIR}}/nginx/gitlab_registry_access.log;
39+
access_log {{GITLAB_LOG_DIR}}/nginx/gitlab_registry_access.log gitlab_access;
4040
error_log {{GITLAB_LOG_DIR}}/nginx/gitlab_registry_error.log;
4141

4242
location / {

assets/runtime/config/nginx/gitlab-ssl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ map $request_uri $obfuscated_request_uri {
3434
~(.+\?)(.*&)?(private_token=|access_token=)[^&]*(&.*|$) $1$2$3****$4;
3535
default $request_uri;
3636
}
37-
log_format main '$remote_addr - $remote_user [$time_local] '
37+
log_format gitlab_ssl_access '$remote_addr - $remote_user [$time_local] '
3838
'"$request_method $obfuscated_request_uri $server_protocol" $status $body_bytes_sent '
3939
'"$http_referer" "$http_user_agent"';
4040

@@ -49,7 +49,7 @@ server {
4949
server_name _; ## Replace this with something like gitlab.example.com
5050
server_tokens off; ## Don't show the nginx version number, a security best practice
5151
return 301 https://$host:{{GITLAB_PORT}}$request_uri;
52-
access_log {{GITLAB_LOG_DIR}}/nginx/gitlab_access.log main;
52+
access_log {{GITLAB_LOG_DIR}}/nginx/gitlab_access.log gitlab_ssl_access;
5353
error_log {{GITLAB_LOG_DIR}}/nginx/gitlab_error.log;
5454
}
5555

@@ -103,7 +103,7 @@ server {
103103
ssl_dhparam {{SSL_DHPARAM_PATH}};
104104

105105
## Individual nginx logs for this GitLab vhost
106-
access_log {{GITLAB_LOG_DIR}}/nginx/gitlab_access.log main;
106+
access_log {{GITLAB_LOG_DIR}}/nginx/gitlab_access.log gitlab_ssl_access;
107107
error_log {{GITLAB_LOG_DIR}}/nginx/gitlab_error.log;
108108

109109
location / {

assets/runtime/functions

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ GITLAB_ACTIONCABLE_CONFIG="${GITLAB_INSTALL_DIR}/config/cable.yml"
2323
GITLAB_SECRETS_CONFIG="${GITLAB_INSTALL_DIR}/config/secrets.yml"
2424
GITLAB_ROBOTS_CONFIG="${GITLAB_INSTALL_DIR}/public/robots.txt"
2525
GITLAB_SHELL_CONFIG="${GITLAB_SHELL_INSTALL_DIR}/config.yml"
26-
GITLAB_NGINX_CONFIG="/etc/nginx/sites-enabled/gitlab"
27-
GITLAB_CI_NGINX_CONFIG="/etc/nginx/sites-enabled/gitlab_ci"
28-
GITLAB_REGISTRY_NGINX_CONFIG="/etc/nginx/sites-enabled/gitlab-registry"
29-
GITLAB_PAGES_NGINX_CONFIG="/etc/nginx/sites-enabled/gitlab-pages"
26+
GITLAB_NGINX_CONFIG="/etc/nginx/conf.d/gitlab.conf"
27+
GITLAB_CI_NGINX_CONFIG="/etc/nginx/conf.d/gitlab_ci.conf"
28+
GITLAB_REGISTRY_NGINX_CONFIG="/etc/nginx/conf.d/gitlab-registry.conf"
29+
GITLAB_PAGES_NGINX_CONFIG="/etc/nginx/conf.d/gitlab-pages.conf"
3030
GITLAB_PAGES_CONFIG="${GITLAB_INSTALL_DIR}/gitlab-pages-config"
3131
GITLAB_GITALY_CONFIG="${GITLAB_GITALY_INSTALL_DIR}/config.toml"
3232

0 commit comments

Comments
 (0)