《一》、git安裝和使用
-
1、 安裝
sudo yum install git
-
2、生成SSH KEY
ssh-keygen
生成公鑰和私鑰, -
3、訪問碼雲(https://gitee.com),配置SSH Key
cat id_rsa.pub
複製公鑰內容到SSH公鑰
配置中 -
4、基本命令
-
5、
推薦學習Git基本命令網址:http://www.runoob.com/git/git-tutorial.html
《二》、php環境配置
- 1:默認版本太低(5.4) 升級php 到5.6
- 1.1.檢查當前安裝的PHP包
yum list installed | grep php
- 1.2如果有安裝的PHP包,先刪除他們
yum remove php.x86_64 php-cli.x86_64 php-common.x86_64 php-gd.x86_64 php-ldap.x86_64 php-mbstring.x86_64 php-mcrypt.x86_64 php-mysql.x86_64 php-pdo.x86_64
- 1.1.檢查當前安裝的PHP包
- 2 : 配置源
sudo rpm -Uvh http://mirror.webtatic.com/yum/el7/epel-release.rpm sudo rpm -Uvh http://mirror.webtatic.com/yum/el7/webtatic-release.rpm
如果想刪除上面安裝的包,重新安裝
rpm -qa | grep webstatic rpm -e 上面搜索到的包即可
- 3:fpm 安裝 和 基本操作
sudo yum install php72w-fpm( 也可以php57w-fpm php72w-fpm ) service php72w-fpm start/restart/stop ps -ef | grep fpm // 查看
- 4、安裝基礎擴展
sudo yum install php72w.x86_64 php72w-cli.x86_64 php72w-common.x86_64 php72w-gd.x86_64 php72w-mbstring.x86_64 php72w-mcrypt.x86_64 php72w-mysql.x86_64 php72w-pdo.x86_64
《三》、thinkphp環境配置
- 1、開啓pathinfo
a、打開vi /etc/php.ini
b、開啓 , 往php.ini
中添加cgi.fix_pathinfo=1
- 2、配置nginx
a、找一個新的域名,或者域名中新建一個二級域名:api.xyz.com
b、在/etc/nginx/conf.d
中新建一個conf配置api.conf
,內容如下:server { listen 80; server_name api.xyz.com; root /data/www/tp/public; index index.php index.html index.htm; access_log /var/log/nginx/access_tp5.log main; location / { try_files $uri $uri/ /index.php?$args; } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; try_files $uri =404; } } // 或者 server { listen 80; server_name api.abc.com; root /data/www/tp/public; index index.php index.html index.htm; add_header X-Powered-Host $hostname; fastcgi_hide_header X-Powered-By; if (!-e $request_filename) { rewrite ^/(.+?\.php)/?(.*)$ /$1/$2 last; rewrite ^/(.*)$ /index.php/$1 last; } location ~ \.php($|/){ fastcgi_index index.php; fastcgi_pass 127.0.0.1:9000; include fastcgi_params; set $real_script_name $fastcgi_script_name; if ($real_script_name ~ "^(.+?\.php)(/.+)$") { set $real_script_name $1; } fastcgi_split_path_info ^(.+?\.php)(/.*)$; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param SCRIPT_NAME $real_script_name; fastcgi_param SCRIPT_FILENAME $document_root$real_script_name; fastcgi_param PHP_VALUE open_basedir=$document_root:/tmp/:/proc/; access_log /home/wwwlog/domain_access.log access; error_log /home/wwwlog/domain_error.log error; } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ { access_log off; error_log off; expires 30d; } location ~ .*\.(js|css)?$ { access_log off; error_log off; expires 12h; } }
- 3、重啓
php-fpm
和nginx
服務systemctl restart nginx.service systemctl restart php-fpm.service
如果出錯,可以用如下命令查看報錯日誌:systemctl status nginx.service -l
===> 騰訊雲Nginx配置HTTPS
SSL證書管理->申請、下載證書,放到雲服務器abc文件夾下
server {
listen 443;
server_name www.xyz.com;
root /data/www/tp/public;
index index.php index.html index.htm;
access_log /var/log/nginx/access_it.log main;
ssl on;
ssl_certificate /abc/1_www.xyz.com_bundle.crt;
ssl_certificate_key /abc/2_www.xyz.com.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
ssl_prefer_server_ciphers on;
...
...
《四》、服務
一、crontab定時任務
二、Logrotate日誌切割
https://www.cnblogs.com/cainiaoliu/p/6259640.html
三、Ntpdate時間同步
- 1、yum install ntp
- 2、繼續在命令行中操作,進行同步時間
ntpdate 111.11.111.11