Installation of Centos7 Nginx and setup of boot-up

Source: Internet
Author: User
Tags install openssl

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
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 install
/application/nginx/sbin/nginx #启动
Ps-ef |grep Nginx #检查有无启动成功
Join power-on self-boot
Edit the following file
#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/$ 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.