分类: Uncategorized
-
FW: Install nginx on Centos 6.x
http://www.cyberciti.biz/faq/install-nginx-centos-rhel-6-server-rpm-using-yum-command/
Step #1: Install nginx repo
# cd /tmp
# wget http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
nginx-release-centos-6-0.el6.ngx.noarch.rpm
# rpm -ivh
Step #2: Install nginx web-server
# yum install nginx
Step #3: Turn on nginx service
# chkconfig nginx on
How do I start / stop / restart nginx web-server?
# service nginx start
# service nginx stop
# service nginx restart
# service nginx status
# service nginx reloadStep #4: Configuration files
- Default configuration directory: /etc/nginx/
- Default SSL and vhost config directory: /etc/nginx/conf.d/
- Default log file directory: /var/log/nginx/
- Default document root directory: /usr/share/nginx/html
- Default configuration file: /etc/nginx/nginx.conf
- Default server access log file: /var/log/nginx/access.log
- Default server access log file: /var/log/nginx/error.log
To edit the nginx configuration file, enter:
# nano /etc/nginx/nginx.conf
Set or update worker_processes as follows (this must be set to CPU(s) in your system. Use the lscpu | grep ‘^CPU(s)’ command to list the number of CPUs in the server)
worker_processes 2;
Turn on gzip support:
gzip on;
Edit the file /etc/nginx/conf.d/default.conf, enter:
# nano /etc/nginx/conf.d/default.conf
Set IP address and TCP port number:listen 199.241.137.179:80;
Set server name:
server_name vps.zhenglei.net;
Start the server:
# service nginx start
Verify that everything is working:
# netstat -tulpn | grep :80
# ps aux | grep nginxFirewall configuration: Open TCP port # 80
Edit the file /etc/sysconfig/iptables, enter:
# nano /etc/sysconfig/iptables
Add the following lines, ensuring that they appear before the final LOG and DROP lines for the INPUT chain to open port 80:-A INPUT -m state --state NEW -p tcp --dport 80 -j ACCEPT
Save and close the file. Finally, restart the firewall:
# service iptables restart
-
mirror debian with rsync
sudo useradd -d /home/ftpsync -m ftpsync
sudo passwd ftpsyncsudo su ftpsync
bash
export http_proxy=…
wget http://ftp-master.debian.org/ftpsync.tar.gz
tar xvfz ftpsync.tar.gzmkdir ~/bin ~/etc ~/log
cp distrib/bin/ftpsync ~/bin/
cp distrib/etc/ftpsync.conf.sample ~/etc/ftpsync.conf
cp distrib/etc/common ~/etc/cat /home/ftpsync/etc/ftpsync.conf
MIRRORNAME=`hostname -f`
RSYNC_DIR=”/home/ftpsync”
TO=”${RSYNC_DIR}/mirrors/debian/”
RSYNC_PATH=”debian”
# amd64 i386 armel armhf
RSYNC_HOST=debian.ustc.edu.cn
#RSYNC_HOST=ftp.cn.debian.org
#RSYNC_HOST=debian.bjtu.edu.cn# amd64 i386 armhf
#RSYNC_HOST=www.anheng.com.cn# amd64 i386
#RSYNC_HOST=mirrors.163.com
#RSYNC_HOST=mirrors.sohu.comLOGDIR=”${RSYNC_DIR}/log”
LOG=”${LOGDIR}/ftpsync.log”
EXCLUDE=””
ARCH_EXCLUDE=”\
alpha \
hppa \
hurd-i386 \
ia64 \
kfreebsd-amd64 \
kfreebsd-i386 \
m68k \
mipsel \
mips \
powerpc \
s390 \
s390x \
sh \
sparc”LOGROTATE=14
UIPRETRIES=3
RSYNC_PROXY=172.24.61.252:8080
RSYNC=rsync
#RSYNC_BW=””