Preface: CentOS system to compile and install each LNMP environment to a new server, or to change the computer needs to be done here only to do a record. A reference for beginners!
First, pre-installation environment
Here is CentOS 7 system.
We default to download the software on the / data / soft (can be set according to personal preference)
The default server applications installed in / data / apps below (according to personal preferences)
First, start the installation
yum -y install wget pcre openssl * gd gd2 gd-devel gd2-devel gcc gcc-c ++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers make
First with the one above commands to install web services to build some of those dependencies must use yum. If the system is already installed will be automatically skipped. If it is not updated to the latest date.
// Add web services user group www, and www users
useradd -g www www
// Ulimit concurrency to improve network performance, do not play their own local setting does not matter
ulimit -SHn 65535
// Prepare to enter the soft catalog download applications
cd / data / soft
// First use wget to download and install nginx must pcre. The latest version is 8.37. You can ask yourself the following url to view the latest version.
tar zxvf pcre-8.37.tar.gz
./configure --prefix = / data1 / apps / libs / pcre
make && make install
// Here pcre installation has been completed.
// Nginx start the download and install the latest stable (stable version) is 1.8.0, rc version has up to 1.94. Download the self-reference. Here, for example by 1.8.0
tar zxvf nginx-1.8.0.tar.gz
./configure --user = www --group = www --prefix = / data / apps / nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre = / data / soft / pcre-8.37 --with -http_realip_module --with-http_image_filter_module
make && make install
// Nginx command to resume bin following soft links, facilitate future direct use nginx command
ln -s / data / apps / nginx / sbin / nginx / usr / local / bin / nginx
// Ps -ef | grep nginx can look at this time and there is no process nginx
// Check again ps -ef | grep nginx nginx master has been found that the process
// Test profile:
nginx -s reload (other: stop, quit, reopen, reload)
to here. You can open the local browser to see http: // localhost've already seen the welcome page. It follows that when you play the nginx.conf configuration. Specifically not elaborate. The only installation record.