Enabling Gitlab pages Not working

I am trying to enable gitlab pages with no luck. It kind of worked once but from one point the pages link on settings menu disappeared and not working anymore.

I have a 13.10.2-ee running behind a custom nginx proxy. I’ve tried to configure pages with the minimum configuration and added the vhost to nginx. The daemon seems to be running but gitlab apparently does not detect it

image

The pipeline runs ok and generates the oublic folder with just an index.html

This is the .gitlab-ci

pages:
  stage: deploy
  script:
    - mkdir .public
    - cp -r * .public
    - mv .public public
  artifacts:
    paths:
      - public
  rules:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH

I tried a lot of configurations on gitlab.rb but none worked for me. Could someone give me more clarity on this?

My vhost for my nginx:

    server {
  listen 0.0.0.0:80;

  server_name gitpages.rigi.tech;

  access_log  /var/log/nginx/gitlab_pages_access.log;
  error_log   /var/log/nginx/gitlab_pages_error.log;

  location / {
    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_cache off;

    proxy_pass http://localhost:8090/;
  }

  error_page 403 /403.html;
  error_page 404 /404.html;
}

Thanks!

Hi @cnp1984
this is my GitLab Pages related config in gitlab.rb

pages_external_url "https://pages.example.com"
gitlab_pages['enable'] = true
gitlab_pages['status_uri'] = "/@status"
gitlab_pages['listen_proxy'] = "127.0.0.1:8090"

pages_external_url must point to your domain gitpages.rigi.tech

1 Like

Here is the GitLab managed Nginx config for Pages with HTTPS and HTTP redirect.

# This file is managed by gitlab-ctl. Manual changes will be
# erased! To change the contents below, edit /etc/gitlab/gitlab.rb
# and run `sudo gitlab-ctl reconfigure`.

## Lines starting with two hashes (##) are comments with information.
## Lines starting with one hash (#) are configuration parameters that can be uncommented.
##
###################################
##         configuration         ##
###################################

## Redirects all HTTP traffic to the HTTPS host
server {
  listen 1.2.3.4:80;
  server_name  ~^(?<group>.*)\.pages\.example\.com$;
  server_tokens off; ## Don't show the nginx version number, a security best practice
  return 301 https://$http_host:$request_uri;
  access_log  /var/log/gitlab/nginx/gitlab_pages_access.log gitlab_access;
  error_log   /var/log/gitlab/nginx/gitlab_pages_error.log;
}

server {
  listen 1.2.3.4:443 ssl http2;
  server_name  ~^(?<group>.*)\.pages\.example\.com$;
  server_tokens off; ## Don't show the nginx version number, a security best practice

  ## Disable symlink traversal
  disable_symlinks on;

  ## Strong SSL Security
  ## https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html & https://cipherli.st/
  ssl_certificate /etc/gitlab/server.crt;
  ssl_certificate_key /etc/gitlab/server.key;

  # GitLab needs backwards compatible ciphers to retain compatibility with Java IDEs
  ssl_ciphers 'ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4';
  ssl_protocols  TLSv1.2 TLSv1.3;
  ssl_prefer_server_ciphers on;
  ssl_session_cache  builtin:1000  shared:SSL:10m;
  ssl_session_timeout  5m;


  ## Real IP Module Config
  ## http://nginx.org/en/docs/http/ngx_http_realip_module.html

  ## Individual nginx logs for this GitLab vhost
  access_log  /var/log/gitlab/nginx/gitlab_pages_access.log gitlab_access;
  error_log   /var/log/gitlab/nginx/gitlab_pages_error.log;

  # Pass everything to pages daemon
  location / {
    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 https;
    proxy_set_header X-Forwarded-Ssl on;

    # Prevent NGINX from caching pages in response to the pages `Cache-Control`
    # header.
    #
    # Browsers already respect this directive and Pages can handle the request
    # volume without help from NGINX.
    #
    # If this changes in the future, ensure `proxy_cache_key` is set to a value
    # like `$scheme$host$request_uri`, as the default value does not take the
    # Pages hostname into account, leading to incorrect responses being served.
    #
    # See https://gitlab.com/gitlab-org/gitlab-pages/issues/73
    proxy_cache off;

    proxy_pass          http://127.0.0.1:8090;
  }

  # Define custom error pages
  error_page 403 /403.html;
  error_page 404 /404.html;


}
1 Like

Thanks to answer.

I tried to configure the same way to see if works but nothing, still the same. I have this now:

pages_external_url = "http://gitpages.rigi.tech/"
gitlab_pages['enable'] = true
gitlab_pages['status_uri'] = "/@status"
gitlab_pages['listen_proxy'] = "127.0.0.1:8090"

After reconfigure and restart i still see the feature as disabled and pages in settings menu does not appear. If i acces to the domain, gitlab returns a 404 page so the daemon retunrs something for that subdomain.

Any idea?

Thanks

Anybody has more ideas? i’m still faecing the issue and it’s being impossible to configure