Niginx download and installation
1. Download
<code>wget http://nginx<span>.org</span>/download/nginx-<span>1.10</span><span>.0</span><span>.tar</span><span>.gz</span></code>
My software has been downloaded to /opt/soft-install
2. Unzip
<code><span>#解压到当前目录</span> tar -zxvf nginx-<span>1.10</span><span>.0</span><span>.tar</span><span>.gz</span> -C .</code>
3. Compile and install
First, you need to understand the meaning of the following commands
Reference: http://feinibuke.blog.51cto.com/1724260/367376
Install to the /opt/soft/nginx-1.10.0 directory
<code><span>cd</span> nginx-<span>1.10</span>.<span>0</span>/ <span># 指定安装到 /opt/soft/ngnix 的目录下</span> ./configure --prefix=/opt/soft/nginx-<span>1.10</span>.<span>0</span></code>
Tips: Lack of C compilation environment
Solution
<code><span>yum</span><span>install</span><span>gcc</span><span>gcc</span><span>-</span><span>c</span><span>+</span><span>+</span></code>
Continue to configure
Tips: The pcre dependency library is missing
Solution
<code>yum <span>install</span> pcre pcre-devel</code>
Tips: The zlib dependency library is missing
Solution
<code>yum <span>install</span> zlib zlib-devel</code>
As shown below, the installation environment is no longer a problem
Summary: Before compiling and installing, you must ensure that the system has installed the following dependent libraries
<code>yum <span>install</span> gcc gcc-c++ yum <span>install</span> pcre pcre-devel yum <span>install</span> zlib zlib-devel</code>
4. Installation
<code><span>make</span> & <span>make</span> install</code>
If you see the following directory structure, it means that the basic installation is OK
5. Test whether Nginx is installed successfully
Start Nginx
<code><span>cd</span> /opt/soft/nginx-<span>1.10</span>.<span>0</span>/ ./sbin/nginx</code>
Open port 80
<code><span>firewall</span><span>-</span><span>cmd</span><span>-</span><span>-</span><span>z/span><span>-</span><span>-</span><span>add</span><span>-</span><span>port=80/tcp</span><span>-</span><span>-</span><span>permanent</span><span>firewall</span><span>-</span><span>cmd</span><span>-</span><span>-</span><span>reload</span></span></code>
Browser access 192.168.2.202
The above interface appears, indicating that Nginx access is successful.
Niginx common commands
1. View Nginx process
<code>ps aux<span>|grep nginx</span></code>
2. View Nginx commands
<code>ngnix <span>-h</span></code>
3. Common Nginx commands
<code><span>#启动</span> ngnix <span>#停止</span> nginx -s stop <span>#重新加载配置</span> nginx -s reload</code>
The above introduces CentOS7 compilation and installation of Nginx, including centos7 content. I hope it will be helpful to friends who are interested in PHP tutorials.