Home >php教程 >PHP开发 >linux and git records

linux and git records

高洛峰
高洛峰Original
2016-11-23 16:00:021362browse

Clear the history of a file on Github

git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch app/img/*' --prune-empty --tag-name-filter cat -- --all

git push origin master --force

rm -rf .git/refs/original/

git reflog expire --expire=now --all

git gc --prune=now

git gc --aggressive --prune=now

Use iconv to convert large file encoding to GB2312 - UTF8

iconv -f gb2312 -t utf-8//IGNORE av-ed2k-collection.data > Japanese teaching.txtwc - l Japanese teaching.txt av-ed2k-collection.data

Limit the number of requests per unit time of a single IP on Nginx, and the number of concurrent connections of a single IP

http {

limit_req_zone $binary_remote_addr zone=one:10m rate=8r/s;

server {
    location /search/ {
        limit_req zone=one burst=5;
    }

Use Nginx to limit page access permissions

sudo apt-get install apache2-utils
sudo htpasswd -c /etc/nginx/.htpasswd myusername
server {
  listen       80;
  server_name  ip_address;

  location /backend {
      root   /var/www/sunzhongwei.com;
      index  index.html index.htm;

      auth_basic "Restricted";                                
      auth_basic_user_file /etc/nginx/.htpasswd;  
  }
}

sudo /etc/init.d/nginx reload

Command line Log in to github

ssh-keygen -t rsa -C "mail"
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/MZero/.ssh/id_rsa):

Log in to github. Click Account Settings in the upper right corner—>SSH and GPG keys—> new SSH key
$ ssh -T git@github.com
If there is a You've successfully authenticated prompt, it means it was successful

git pull/push project The solution to always prompting to enter username and password

git config --global credential.helper store

Server settings allow mysql remote login

vi /etc/sysconfig/iptables

-A INPUT -m state -- state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
service iptables restart
grant all on aaa.* to "root"@xx .yy.zz.cc identified by "123";
flush privileges;
grant all on aaa.* to "root"@"%" identified by "123";

ssh configuration key login

ssh-keygen -t rsa -C "you@homestead"

$ sudo vim /etc/ssh /sshd_config
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizeKeyFile ~/.ssh/authorized_keys
service sshd restart
Append the contents of the public key file to the ~/.ssh/authorized_keys file, and set the file permissions to 600
chmod 600 ~/ .ssh/authorized_keys

$ vim .bash_profile
alias c14='ssh [username]@[server_ip] (-i ~/.ssh/[private key file])'
$ source .bash_profile
$ c14

Solutions to Nginx reporting 502

nginx error reporting, check the nginx log to troubleshoot
nginx reporting 502 bad gate way is usually because php-fpm is not configured properly
Restart after modifying the nginx or php-fpm configuration file to take effect

nginx Add https And http2 module support

curl https://nginx.org/download/ng... |
tar xzf - && cd nginx-* # get latest nginx & extract it
./configure [old_config_arguments] --with-http_ssl_module --with-http_v2_module # The previous [old_config_arguments] can be copied from nginx -V
make
sudo make install
listen 443 ssl http2;
ssl_certificate /home/brook/ssl/chained.pem;
ssl_certificate_key /home/brook/ssl /domain.key;
ssl_dhparam /home/brook/ssl/dhparams.pem;
ssl_ciphers EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES: RSA+ 3DES:!MD5;
ssl_prefer_server_ciphers on;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_session_cache shared:SSL:50m;
ssl_session_timeout 1d;
ssl_session_tickets on;
add _header Strict-Transport-Security max-age=31536000;
service reload nginx

pphpmyadmin missing mcrypt extension

sudo apt-get install php-mcrypt libmcrypt libmcrypt-devel
sudo ln -s /etc/php5/mods-available/mcrypt.ini 20-mcrypt.ini
sudo service apache2 restart

How to view request response time using curl command

curl -o /dev/null -s -w %{time_namelookup}::%{time_connect}::%{time_starttransfer}::%{time_total}::%{speed_download} "n" http://www.36nu.com

0.014::0.015::0.018::0.019::1516256.00

Use github to display your front-end page

Create a project and create a new gh-pages branch through http:/ /(user_name|org_name).g... Access
A simpler way to achieve it: upload the code to the warehouse and configure GitHub Pages in the settings to the branch you want to display


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn