installation of nginx corresponding software
Yum-y Install Pcre Pcre-devel
Yum-y Install Openssl-devel OpenSSL
Yum-y Install gcc-c++
Installing the Software
Mkdir-p/home/tools #用于存放nginx -1.6.3.tar.gz
Useradd www-s/sbin/nologin-m
Cd/home/tools
Wget-q http://nginx.org/download/nginx-1.6.3.tar.gz
Tar XF nginx-1.6.3.tar.gz
CD nginx-1.6.3
./configure--user=www--group=www--with-http_stub_status_module--with-http_ssl_module--prefix=/application/ nginx-1.6.3
Make
Make install
Ln-s/application/nginx-1.6.3//application/nginx
/application/nginx/sbin/nginx #启动
Ps-ef |grep Nginx #检查有无启动成功
Join power-on self-boot
Edit the following file
Vim/etc/init.d/nginx
#!/bin/sh
#chkconfig: 2345 80 90?
Description:start and Stop Nginx
Path=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin desc= "Nginx daemon" Name=nginx DAEMON=*/app lication/nginx*/sbin/$NAME configfile=*/application/nginx/*conf/$NAME. conf pidfile=*/application/nginx*/logs/$ Name.pid scriptname=/etc/init.d/$NAME set-e [-X "$DAEMON"] | | Exit 0 Do_start () {$DAEMON-c $CONFIGFILE | | echo-n "Nginx already Running"} do_stop () {kill-int ' cat $PIDFILE ' | | Echo-n "Nginx not Running"} do_reload () {kill-hup ' cat $PIDFILE ' | | echo-n ' nginx can ' t reload '} case "$" in start) echo-n "Starting $DESC: $NAME" Do_start echo "." ;; Stop) echo-n "stopping $DESC: $NAME" Do_stop echo "." ;; reload|graceful) echo-n "Reloading $DESC configuration ..." do_reload echo ".; Restart) echo-n "Restarting $DESC: $NAME" Do_stop do_start echo ". ;; *) echo "Usage: $SCRIPTNAME {start|stop|reload|restart}" >&2 exit 3;; ESAC Exit 0
You just need to add that content
/application/nginxReplace with the corresponding installation directory
改变其权限: chmod +x /etc/init.d/nginx service nginx stop chkconfig --add nginx chkconfig nginx on service nginx start重启之后查看是否加入开机自启动`` ps -ef |grep nginx
Installation of Centos7 Nginx and setup of boot-up