omnibus-gitlab与系统默认nginx的强行融合

只需从/var/opt/gitlab/nginx/conf/nginx.conf中提取关键配置,插入到系统nginx.conf之中。

/etc/gitlab/gitlab.rb中的nginx['enable']禁用,unicorn['enable']启用。

sudo gitlab-ctl reconfigure

【170504】服务器管理记录(CentOS 7 2)

  • Some port may be blocked by the firewall, thus cannot be visit.

iptables -L -n

Check /etc/sysconfig/iptables and edit the rules, then restart the iptable service to make it work.

service iptables restart

  • tomcat default port

See /usr/local/apache-tomcat/conf/server.xml

  • nginx default port

ps aux | grep nginx

/usr/local/nginx/conf/nginx.conf

listen 8080 default_server;
listen [::]:8080 default_server ipv6only=on;

error adding listener addr=/var/opt/gitlab/gitlab-rails/sockets/gitlab.socket

chown git gitlab.socket

adding listener failed addr=127.0.0.1:8080 (in use)

gitlab-ctl tail unicorn

  • firewalld

systemctl unmask firewalld

systemctl start firewalld

systemctl status firewalld

sudo firewall-cmd –permanent –add-service=http

  • nginx configure compatible with gitlab
# gitlab socket 文件地址
upstream gitlab {
  server unix://var/opt/gitlab/gitlab-rails/sockets/gitlab.socket;
}

server {
  listen *:8080;

  server_name gitlab.semprathlon.net;   # 

  server_tokens off;     # don't show the version number, a security best practice
  root /opt/gitlab/embedded/service/gitlab-rails/public;

  # Increase this if you want to upload large attachments
  # Or if you want to accept large git objects over http
  client_max_body_size 250m;

  # individual nginx logs for this gitlab vhost
  access_log  /var/log/gitlab/nginx/gitlab_access.log;
  error_log   /var/log/gitlab/nginx/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 pass the request to the upsteam (gitlab unicorn)
  location @gitlab {
    # If you use https make sure you disable gzip compression 
    # to be safe against BREACH attack

    proxy_read_timeout 300; # Some requests take more than 30 seconds.
    proxy_connect_timeout 300; # Some requests take more than 30 seconds.
    proxy_redirect     off;

    proxy_set_header   X-Forwarded-Proto $scheme;
    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-Frame-Options   SAMEORIGIN;

    proxy_pass http://gitlab;
  }

  # Enable gzip compression as per rails guide: http://guides.rubyonrails.org/asset_pipeline.html#gzip-compression
  # WARNING: If you are using relative urls do remove the block below
  # See config/application.rb under "Relative url support" for the list of
  # other files that need to be changed for relative url support
  location ~ ^/(assets)/  {
    root /opt/gitlab/embedded/service/gitlab-rails/public;
    # gzip_static on; # to serve pre-gzipped version
    expires max;
    add_header Cache-Control public;
  }

  error_page 502 /502.html;
}
  • gitlab 502 error debug

gitlab-ctl tail

gitlab.socket permission denied

sudo usermod -aG gitlab-www git

http://www.doocr.com/articles/58b1599ee21ae505cb93a717

chgrp -R gitlab-www /var/opt/gitlab/gitlab-rails

chown -R www /var/opt/gitlab/gitlab-rails

  • ./configure, cannot find htmlcxx. Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-stand …

https://askubuntu.com/questions/210210/pkg-config-path-environment-variable

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig

  • error while loading shared libraries: libhtmlcxx.so.3: cannot open shared object file: No such file

http://stackoverflow.com/questions/480764/linux-error-while-loading-shared-libraries-cannot-open-shared-object-file-no-s

sudo ldconfig

2016-2017 SSL证书更新

在前证书过期一周有余,期末考试完成之后,新的SSL免费证书总算申请上了。

WoSign竟然早已关闭了免费证书申请。这次是向腾讯云申请到的。

关于常见网络设备上运行的嵌入式系统的初步认识

在企业型的大型网关设备上常见Unix操作系统,TTL=255.

在个人型的小型路由器、交换机上常见Linux操作系统,TTL=63.

通过端口扫描可得到目标主机上开放的端口、运行的服务,进而推断操作系统。

ssh常用端口为22,telnet常用端口为23.

【160713】服务器管理记录

uname -a

解决jdbc连接SQL Server常见连接错误

错误信息:
通过端口 1433 连接到主机 localhost 的 TCP/IP 连接失败。错误:“connect timed out。请验证连接属性。确保 SQL Server 的实例正在主机上运行,且在此端口接受 TCP/IP 连接,还要确保防火墙没有阻止到此端口的 TCP 连接。”。

重要前提:

  • 确保数据库允许远程连接
  • 确保登录名允许远程连接

检查错误:
打开Sql Server Configuration Manager,选中左栏SQL Server网络配置=>< 服务名>的协议,双击TCP/IP以弹出对话框。


特别注意最下方IPAll项的端口设置。
按图设置,重启SQL Server服务后生效。

telnet 127.0.0.1 1433 可供测试端口。

【160610】服务器管理记录

  • Ubuntu查看运行中的进程及其id、监听端口

    sudo netstat -anp

  • 查询进程id

    pidof

  • 安全终止某个进程

    kill -15

  • 后台运行某个进程

    nohup&

内存空间不足的临时解决办法
How To Create A Swap File In Linux

linux下由于内存不足造成的 virtual memory exhausted: Cannot allocate memory, qt **.o文件 file not found

configure-apache-to-listen-on-port-other-than-80

http://askubuntu.com/questions/256013/could-not-reliably-determine-the-servers-fully-qualified-domain-name

启用强制https访问

为了从http跳转到https网址,在本站点根目录的.htaccess中增加一条转向规则:
RewriteCond %{SERVER_PORT} ^80$ RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]

Read more