您好,登錄后才能下訂單哦!
a.修改 /etc/sysconfig/network-scripts/ifcfg-eth0配置文件,添加如下內容 DEVICE=eth0 HWADDR=00:0C:29:96:01:6B TYPE=Ethernet UUID=41cbd943-024b-4341-ac7a-e4d2142b4938 ONBOOT=yes NM_CONTROLLED=yes BOOTPROTO=none IPADDR=xxx.xxx.x.xxx #例如:IPADDR=192.168.2.140 NETMASK=255.255.255.0 GATEWAY=192.168.2.2 b.修改/etc/resolv.conf配置文件,添加如下內容 nameserver 192.168.2.2 c.service network restart d.ifconfig e.ping www.baidu.com 如果能拼通表示可以連接外部網絡
a.備份原有的源 mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup b.下載新的CentOS-Base.repo 到/etc/yum.repos.d/這個目錄下 CentOS 5 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo 或者 curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo CentOS 6 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo 或者 curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo CentOS 7 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo 或者 curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo c.運行yum makecache命令生成緩存
yum -y install gcc openssl-devel pcre-devel zlib-devel
a.下載或上傳tengine-2.1.0.tar.gz到/opt下 ls /opt cd /opt b.解壓 tar -zxvf tengine-2.1.1.tar.gz ls cd tengine-2.1.0 ls c.檢查依賴 ./configure \ --prefix=/opt/sxt/soft/tengine-2.1.0/ \ --error-log-path=/var/log/nginx/error.log \ --http-log-path=/var/log/nginx/access.log \ --pid-path=/var/run/nginx/nginx.pid \ --lock-path=/var/lock/nginx.lock \ --with-http_ssl_module \ --with-http_flv_module \ --with-http_stub_status_module \ --with-http_gzip_static_module \ --http-client-body-temp-path=/var/tmp/nginx/client/ \ --http-proxy-temp-path=/var/tmp/nginx/proxy/ \ --http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ \ --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi \ --http-scgi-temp-path=/var/tmp/nginx/scgi \ --with-pcre d.編譯并安裝 make && make install
a.在/etc/init.d下面建立nginx文件,內容如下 #!/bin/bash # # chkconfig: - 85 15 # description: nginx is a World Wide Web server. It is used to serve # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. . /etc/sysconfig/network # Check that networking is up. [ "$NETWORKING" = "no" ] && exit 0 nginx="/usr/tengine-2.1/sbin/nginx" prog=$(basename $nginx) NGINX_CONF_FILE="/usr/tengine-2.1/conf/nginx.conf" #[ -f /etc/sysconfig/nginx ] && . /etc/sysconfig/nginx lockfile=/var/lock/subsys/nginx #make_dirs() { # # make required directories # user=`nginx -V 2>&1 | grep "configure arguments:" | sed 's/[^*]*--user=\([^ ]*\).*/\1/g' -` # options=`$nginx -V 2>&1 | grep 'configure arguments:'` # for opt in $options; do # if [ `echo $opt | grep '.*-temp-path'` ]; then # value=`echo $opt | cut -d "=" -f 2` # if [ ! -d "$value" ]; then # # echo "creating" $value # mkdir -p $value && chown -R $user $value # fi # fi # done #} start() { [ -x $nginx ] || exit 5 [ -f $NGINX_CONF_FILE ] || exit 6 # make_dirs echo -n $"Starting $prog: " daemon $nginx -c $NGINX_CONF_FILE retval=$? echo [ $retval -eq 0 ] && touch $lockfile return $retval } stop() { echo -n $"Stopping $prog: " killproc $prog -QUIT retval=$? echo [ $retval -eq 0 ] && rm -f $lockfile return $retval } restart() { configtest || return $? stop sleep 1 start } reload() { configtest || return $? echo -n $"Reloading $prog: " # -HUP是nginx平滑重啟參數 killproc $nginx -HUP RETVAL=$? echo } force_reload() { restart } configtest() { $nginx -t -c $NGINX_CONF_FILE } rh_status() { status $prog } rh_status_q() { rh_status >/dev/null 2>&1 } case "$1" in start) rh_status_q && exit 0 $1 ;; stop) rh_status_q || exit 0 $1 ;; restart|configtest) $1 ;; reload) rh_status_q || exit 7 $1 ;; force-reload) force_reload ;; status) rh_status ;; condrestart|try-restart) rh_status_q || exit 0 ;; *) echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}" exit 2 esac b.修改nginx配置文件 將nginx="/usr/tengine-2.1/sbin/nginx"修改為nginx="/opt/sxt/soft/tengine-2.1.0/sbin/nginx" 將NGINX_CONF_FILE="/usr/tengine-2.1/conf/nginx.conf"修改為NGINX_CONF_FILE="/opt/sxt/soft/tengine-2.1.0/conf/nginx.conf" 保存退出:wq c.給nginx添加執行權限 chmod 755 nginx d.啟動服務 service nginx start e.在d步時會報錯,需要手動創建/var/tmp/nginx/client/這個目錄 mkdir -p /var/tmp/nginx/client/ service nginx start f.關閉防火墻 service iptables stop
http://192.168.2.140/
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。