Linux 笔记
nginx -s reload
有,是shutdown -r now 命令和reboot 命令。
shutdown -r now 命令,-s 关机,-r 重启,-t 时间,后面是数字是你要设置的秒数,-a 取消命令,如果要取消定时命令可以 shutdown -a。
*****************************证书*****************************
openssl pkcs12 -in xxx.pfx -nodes -out server.pem
openssl rsa -in server.pem -out server.key
openssl x509 -in server.pem -out server.crt
****************************systemctl****************************
systemctl status
systemctl stop
systemctl start
****************************日常操作****************************
mv h5.kuaiex.com/ /home/wwwroot/
chmod 777 /home/wwwroot/admin.kuaiex.cn/backend/web/assets
chown -R www:www /home/wwwroot/admin.kuaiex.cn/backend/web/assets
rm -rf /home/wwwroot/yii2admin/frontend/runtime/*
vim
cd ..
./run.sh>run.log
du -sh *
cp -r photo/ /home/wwwroot/m.kuaiex.cn/photo/
cp -r dir1 dir2
history 操作日志
w 在线用户 who
last still logged in
history | grep '2019-06-06'
****************************配置nginx****************************
需要重新编译nginx
https://blog.csdn.net/ntc10095/article/details/60468576
lnmp***************************
cd /root/lnmp1.5/src
tar zxvf nginx-1.14.1.tar.gz
cd nginx-1.14.1
./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_v2_module --with-http_gzip_static_module --with-http_sub_module --with-stream --with-stream_ssl_module --with-openssl=/root/lnmp1.5/src/openssl-1.0.2o --with-ld-opt='-ljemalloc' --with-http_image_filter_module
make
make install
nginx -V
****************************数据库****************************
mysql -uroot -proot
show databases;
create database kuaiex;
use yii2admin;
set names utf8;
source /root/kuaiex.sql;
show tables;
create table kuaiex;
describe 表名;
SELECT * FROM 表名
insert into name(uname,gender,birthday) values('张三','男','1971-10-01');
update name set birthday='1971-01-10' where uname='张三';
delete from name where uname='张三';
drop table 表名;
drop database 库名;
mysqldump -uroot -proot yii2admin yii2_account >yii2admin_account.sql
****************************用户***************************
//添加一个名为tommy的用户
adduser root
//修改密码
passwd root
****************************下载****************************
wget https://www.kuaiex.com/danger/kuaiex.pdf
scp -r h5.kuaiex.com/ root@47.244.97.57:/root
tar xf clamav-0.100.0.tar.gz
压缩时不是 .tar.gz 会解压出一个文件,而不是文件夹
tar cvf vendor.tar.gz vendor
****************************挂载****************************
查看空间
df -h
查看挂载
fdisk -l
设置分区
fdisk /dev/vdb
根据提示,输入n,p,1,回车,回车,wq,保存退出。
fdisk -l
格式化
mkfs.ext3 /dev/vdb1
创建目录挂载
echo '/dev/vdb1 /mnt ext3 defaults 0 0' >> /etc/fstab
挂载
mount /dev/vdb1 /home
解除挂载
umount /dev/vdb1
umount /mnt
ssh -v root@47.244.97.57
****************************线程****************************
kill 3141
执行权限
chmod -r +x api.kuaiex
ps aux | grep html2pdf
ps aux | grep qrcode
ps aux | grep base2img
ps aux | grep api.kuaiex
****************************IP****************************
iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 10083 -j ACCEPT
iptables -A OUTPUT-m state --state NEW -m tcp -p tcp --dport 10083 -j ACCEPT
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -A OUTPUT -p tcp --sport 22 -j ACCEPT
iptables -L -n
ps aux | grep 10085
ps aux | grep api.kuaiex
firewall-cmd --zone=public --add-port=10083/tcp --permanent
****************************SVN****************************
svn co svn://192.182.2.100
svn update
svn add name
svn ci -m ""
svn di
svn resolved js/download.js
svn log
svn update -r 14119
****************************git****************************
git clone url //下载
git init name //创建
git add FlutterOpenAccount/ //跟踪新文件
git commit -m text //提交跟踪文件
git push -u origin master //提交
git brand //当前分支
git diff //不同
git --help
//冲突
git stash
git merge origin/master
git stash pop
**************************检查************************
ssh root@120.76.189.187
ssh root@47.244.97.57
systemctl stop clamav-freshclam.service
/usr/local/clamav/bin/freshclam
systemctl start clamav-freshclam.service
systemctl status clamav-freshclam.service
clamscan -r --bell -i / /home --remove -l /var/log/clamscan.log
last
systemctl status nginx.service
top
****************************gem***************************
gem sources -l
gem sources --remove https://ruby.taobao.org/
gem sources -a https://gems.ruby-china.com/
gem update
sudo gem install cocoapods
****************************镜像地址***************************
gem:
gem sources --remove https://ruby.taobao.org/
gem sources -a https://gems.ruby-china.com/
gem update
gem sources -l
npm:
npm config set registry https://gems.ruby-china.com/
npm config set disturl https://gems.ruby-china.com/
npm config get registry
npm config edit
****************************环境变量***************************
source .bash_profile
****************************yum***************************
yum remove clamav-freshclam
yum install clamav-freshclam
**************************限制IP************************
vim /etc/hosts.allow
sshd:192.168.1.*:allow
sshd:all:deny
vim /etc/hosts.deny
sshd:ALL
service sshd restart
systemctl status firewalld
hosts.allow和hosts.deny支持且只支持使用了libwrap库的服务。
strings /usr/sbin/sshd | grep hosts_access
ldd /usr/sbin/sshd | grep libwrap
.......
daemon, daemon, ...: client, client, ...: option
daemon 要监控的服务,如 telnetd、ftpd、sshd
client 主机名、IP 地址/IP 范围,或域名
allow 允许对客户端的访问
deny 拒绝对客户端的访问
except 会匹配第一个列表中所有项,除非匹配第二个列表。例如,允许 domainA 中所有项,除了 hostX.domainA 和 hostY.domanA。
.......
telnetd,sshd:.mydomain.com :allow
telnetd,sshd:192.168.4.10 , 192.168.6.: allow
ftpd:.mydomain.com except uktrip1.mydomain.com, uktrip2.mydomain.com : allow
**************************ping和端口************************
防火墙问题
ping 域名只能保证域名设置正不正确
ping http://www.kuaiex.com
wget 才能保证能否访问到服务器
wget www.kuaiex.com
Connecting to www.guodu.com.hk|202.55.17.5|:80... connected.
HTTP request sent, awaiting response... Read error (Connection reset by peer) in headers.
Retrying.
Connecting to www.guodu.com.hk|202.55.17.5|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 15080 (15K) [text/html]
Saving to: ‘index.html’
index.html 100%[===============================>] 14.73K --.-KB/s in 0.02s
2019-02-28 09:22:21 (655 KB/s) - ‘index.html’ saved [15080/15080]
**************************限制IP登陆************************
常用端口
http://tool.oschina.net/commons?type=7
什么是daemon
https://blog.csdn.net/csdn2798694115/article/details/80029322
daemon:守护进程
telnetd,sshd,ftpd,httpd80,httpsd8088
iptables,nfs,ypbind,dhcpd等
ps axj:其终端名(TTY)显示为?,终端前台进程组ID(TPGID)显示为-1