跳至主要内容

博文

Nginx命令大全

nginx #打开 nginx nginx -t    #测试配置文件是否有语法错误 nginx -s reopen #重启Nginx nginx -s reload   #重新加载Nginx配置文件,然后以优雅的方式重启Nginx nginx -s stop  #强制停止Nginx服务 nginx -s quit  #优雅地停止Nginx服务(即处理完所有请求后再停止服务) nginx [-?hvVtq] [-s signal] [-c filename] [-p prefix] [-g directives] -?,-h           : 打开帮助信息 -v              : 显示版本信息并退出 -V              : 显示版本和配置选项信息,然后退出 -t              : 检测配置文件是否有语法错误,然后退出 -q              : 在检测配置文件期间屏蔽非错误信息 -s signal       : 给一个 nginx 主进程发送信号:stop(强制停止), quit(优雅退出), reopen(重启), reload(重新加载配置文件) -p prefix       : 设置前缀路径(默认是:/usr/share/nginx/) -c filename     : 设置配置文件(默认是:/etc/nginx/nginx.conf) -g directives   : 设置配置文件外的全局指令

CentOS 7 定时计划任务设置

概述    就像再windows上有计划任务一样,centos7 自然也有计划任务,而且设置更为灵活,好用。再centos7 上可以利用crontab 来执行计划任务, 依赖与 crond 的系统服务,这个服务是系统自带的,可以直接查看状态,启动,停止。    安装 crontabs服务并设置开机自启 yum install crontabs  systemctl enable crond (设为开机启动)  systemctl start crond(启动crond服务)  systemctl status crond (查看状态)  设置用户自定义定时任务 vi /etc/crontab   可以看到:  Example of job definition:  .---------------- minute (0 - 59)  | .------------- hour (0 - 23)  | | .---------- day of month (1 - 31)  | | | .------- month (1 - 12) OR jan,feb,mar,apr ...  | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat  | | | | |  * * * * * user-name command to be executed  即:  分钟(0-59) 小时(0-23) 日(1-31) 月(11-12) 星期(0-6,0表示周日) 用户名 要执行的命令 */30 * * * root /usr/local/mycommand.sh  (每天,每30分钟执行一次 mycommand命令) * 3 * * * root /usr/local/mycommand.sh  (每天凌晨三点,执行命令脚本,PS:这里由于第一个的分钟没有设置,那么就会每天凌晨3点的每分钟都执行一次命令) 0 3 * * * root /usr/local/myc...

centos7 firewalld 防火墙的设置

CentOS 7 firewalld よく使うコマンド centos7 firewalld firewall-cmd CentOS 7ではファイアウォール(以下、FW)のサービスが iptables から firewalld に変わりました。 FWの設定は基本的に firewall-cmd にて行います。よく使うコマンドをまとめます。 サービスの起動 「bash-completion」がインストール済みの場合、[TAB]キーで補完可能です。 サービス名を指定する際の「.service」は省略可能です。 サービスの起動 # systemctl start firewalld.service サービスの状態確認 # systemctl status firewalld.service # firewall-cmd --state running <余談>サービスの終了 # systemctl stop firewalld.service 自動起動の設定 自動起動の設定 # systemctl enable firewalld.service 自動起動設定の状態確認 # systemctl is-enabled firewalld.service enabled <余談>自動起動の解除 [root@localhost ~]# systemctl disable firewalld.service Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service. Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service. [root@localhost ~]# systemctl is-enabled firewalld.service disabled 設定の確認 ゾーンの割り当て状態 firewalld にはゾーンという概念があり、ゾーンにFWの設定が入っています。ゾーンは標準で9つ用意されています。(追加も可能) NIC に対して、ゾーンを割り当て...