【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

【161114】服务器管理记录

Fatal Error: ezSQL_mysql requires mySQL Lib to be compiled and or linked in to the PHP engine

yum install php56w-mysql

restart Apache

Ubuntu升级gcc,g++

【161110】服务器管理记录

15 Practical Linux cURL Command Examples

typically:

curl -O [url]

MySQL: allow remote connection

allow connection from arbitrary hostname:

mysql>GRANT ALL PRIVILEGES ON . TO ‘[username]‘@’%’ IDENTIFIED BY ‘[password]’ WITH GRANT OPTION;
mysql>FLUSH RIVILEGES

allow connection from specific hostname:

mysql>GRANT ALL PRIVILEGES ON . TO ‘[username]‘@’[hostname]’ IDENTIFIED BY ‘[password]’ WITH GRANT OPTION;
mysql>FLUSH RIVILEGES

How to locate MySQL configuration file?

The file might be in 5 (or more?) locations
/etc/my.cnf
/etc/mysql/my.cnf
$MYSQL_HOME/my.cnf
[datadir]/my.cnf
~/.my.cnf

How to locate Nginx configuration file?

The primary configuration file is /etc/nginx/nginx.conf.
Other possible locations include /opt/nginx/conf/.

How to locate Apache configuration file?

Usually /etc/httpd/conf/httpd.conf.

Create an info.php to reveal Apache environment (risky).

< ?php
phpinfo();
?>

Install Apache2, PHP5 And MySQL Support On CentOS 6.5 (LAMP)

the Apache service is located at /etc/init.d/httpd.

How To Install Linux, nginx, MySQL, PHP (LEMP) stack on CentOS 6