nginx网页只有指定ip才能访问
让nginx服务器上的某个页面只有指定ip才能访问,只需要在server内添加如下字段即可.
server
{
location /nginxallstatus {
stub_status on;
allow 60.195.252.106;
access_log on;
deny all;
}
}
linux下如何查看自己的外网IP
由于局域网的服务器是通过ADSL路由器连接外网的,但ADSL是从ISP运营商那儿通过动态获得IP的,那么我怎么知道自己的外网地址是多少呢?
现在介绍两个方法:
1、直接在命令行敲如下命令:
curl -s http://whatismyip.org
2、敲命令:
wget http://whatismyip.org
然后再敲命令:
cat index.html
以上两种方法均通过实践验证,确实有效.
Linux crontab 用法
安装crontab:
[root@CentOS ~]$ yum install vixie-cron
[root@CentOS ~]$ yum install crontabs
说明:
vixie-cron软件包是cron的主程序.
crontabs软件包是用来安装、卸装、或列举用来驱动 cron 守护进程的表格的程序.
cron 是linux的内置服务,但它不自动起来,可以用以下的方法启动、关闭这个服务:
基本命令:
服务的启动和关闭:
/sbin/service crond start //启动服务
/sbin/service crond stop //关闭服务
/sbin/service crond restart //重启服务
/sbin/service crond reload //重新载入配置
查看crontab服务状态:
service crond status
手动启动crontab服务:
service crond start
查看crontab服务是否已设置为开机启动,执行命令:
ntsysv
加入开机自动启动:
chkconfig --level 35 crond on
crontab命令:
功能说明:设置计时器.
语法:
crontab [-u ][配置文件] 或 crontab [-u ][-elr]
补充说明:
cron是一个常驻服务,它提供计时器的功能,让用户在特定的时间得以执行预设的指令或程序.只要用户会编辑计时器的配置文件,就可以使用计时器的功能.
其配置文件格式如下:
Minute Hour Day Month DayOFWeek Command
参数:
-e 编辑该用户的计时器设置.
-l 列出该用户的计时器设置.
-r 删除该用户的计时器设置.
-u 指定要设定计时器的用户名称.
crontab 格式:
基本格式 :
* * * * * command
分 时 日 月 周 命令
第1列表示分钟1~59 每分钟用*或者...
skill-命令使用方法介绍(linux命令)
一般参数:
-f 快速模式/尚未完成
-i 互动模式/ 每个动作将要被确认
-v 详细输出/ 列出所选择程序的资讯
-w 智能警告讯息/ 尚未完成
-n 没有动作/ 显示程序代号
参数:选择程序的规则可以是, 终端机代号,使用者名称,程序代号,命令名称.
-t 终端机代号 ( tty 或 pty )
-u 使用者名称
-p 程序代号 ( pid )
-c 命令名称 可使用的讯号:
范例:
停止所有在PTY装置上的程序:
skill -KILL -v pts/*
停止三个使用者 user1,user2,user3:
skill -STOP user1 user2 user3
centos 安装rar
到http://www.rarsoft.com/download.htm下载最新的rarforlinux,然后进行安装:
tar -zxvf rarlinux-x64-4.2.b1.tar.gz
cd rar
make
make install
centos就可以解压rar了. 再试试rar命令:
[root@centos rar]$ rar
RAR 3.91 Copyright (c) 1993-2009 Alexander Roshal 12 Dec 2009
Shareware version Type RAR -? for help
Usage: rar - -
a Add files to archive
c Add archive comment
cf Add files comment
ch Change archive parameters
cw Write archive comment to file
d Delete files from archive
e Extract files to current directory
f Freshen files in archive
i[par]= Find string in archives
k Lock archive
l[t,b] List archive [technical, bare]
m[f] Move to archive [files only]
p Print file to stdout
r Repair archive
rc Reconstruct missing volumes
rn ...
tomcat修改网站目录
找到tomcat的server.xml(在conf目录下),找到:
"localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">;
在前插入:
"" docBase="D:/eclipse3.3/jb51.net/tomcat/" debug="0"/>
其中 D:/eclipse3.3/jb51.net/tomcat/就是我想设置的网站根目录,然后重启tomcat.