CENTOS67 Source Compiler installation Nginx

Source: Internet
Author: User
Because in the process of looking for a tutorial, there are a variety of problems, so I synthesize, do their own summary, hope can help others, because it is after a few days before the hair, has not been able to find someone else's link. Please forgive me.

Before installing Nginx, you need to ensure that the system has g++, GCC, Openssl-devel, Pcre-devel, and Zlib-devel software installed.

# yum Install gcc-c++

# yum-y Install zlibzlib-devel OpenSSL openssl--devel pcre pcre-devel

Check the ningx of the system installation

# Find-name Nginx

./nginx

./nginx/sbin/nginx

./nginx-1.2.6/objs/nginx

(PS: Yellow for the found content)

If any, uninstall the original Nginx system

# yum Remove Nginx

Upload the installation package file to the directory, this article is uploaded to/usr/local, follow the command below.

[Root@admin local]# cd/usr/local

[Root@admin local]# tar-zxv-f nginx-1.2.6.tar.gz

[Root@admin local]# rm-rfnginx-1.2.6.tar.gz

[Root@admin local]# cd/usr/local/nginx-1.2.6

[Root@admin nginx-1.2.6] #mkdir-P/usr/local/nginx

[Root@admin nginx-1.2.6]#./configure--prefix=/usr/local/nginx

[Root@admin nginx-1.2.6] #make

[Root@admin nginx-1.2.6] #make Install

Configure the firewall to open 80 port, do not open, sometimes the firewall will not let the extranet access to 80 port we will not be able to access the Nginx configuration site.

#修改防火墙配置:

[Root@admin nginx-1.2.6]# vi+/etc/sysconfig/iptables

#添加配置项

-A input-m state--state new-m tcp-p TCP--dport 80-j ACCEPT

(PS: Change the statement to be added in -A input-m State--state new-m tcp-p TCP--dport 22-j ACCEPT after a row )

#重启防火墙

[Root@admin nginx-1.2.6] #service iptables restart

Enable Nginx command

#方法1

[Root@admin nginx-1.2.6]#/usr/local/nginx/sbin/nginx-c/usr/local/nginx/conf/nginx.conf

#方法2

[Root@admin nginx-1.2.6]# Cd/usr/local/nginx/sbin

[Root@admin sbin]#./nginx

Stop Nginx Command

#查询nginx主进程号

Ps-ef | grep nginx

#停止进程

Kill-quit Main process Number

#快速停止

Kill-term Main process Number

#强制停止

Pkill-9 Nginx

Restart Nginx command

[Root@admin local]#/usr/local/nginx/sbin/nginx-s Reload

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

The above describes the CENTOS67 source code compiler installation Nginx, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • 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: info-contact@alibabacloud.com 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.