Home > Backend Development > PHP Tutorial > Nginx installation method

Nginx installation method

WBOY
Release: 2016-07-29 08:58:23
Original
1040 people have browsed it

Introduction: This article briefly introduces the installation and startup process of Nginx under the Linux platform.

Note: Since the performance and widespread use of Nginx on the Windows platform are not as good as Nginx on the Linux platform, this tutorial is mainly targeted at the Linux platform.

First visit the official website of Nginx http://nginx.org/ and download the source code of Nginx (link http://nginx.org/download/nginx-1.8.0.tar.gz).
Next start the installation process. In order to facilitate version management and distinguish different versions, use root to log in to the system, create the directory Nginx_180 in the system root directory '/', and use the code as follows:

<code>[root<span>@localhost</span> ~]<span># mkdir /Nginx_180</span></code>
Copy after login

After that, download the nginx-1.8.0.tar. gz is copied to the /Nginx_180 directory, use the following code:

<code>[root<span>@localhost</span><span>Downloads</span>]<span># cp nginx-1.8.0.tar.gz /Nginx_180</span></code>
Copy after login

Next, decompress the package, locate the directory to /Nginx_180, use the following code:

<code>[root<span>@localhost</span><span>Nginx_180</span>]<span># tar xf nginx-1.8.0.tar.gz</span></code>
Copy after login

In this way, an nginx-1.8 is generated in the Nginx_180 directory .0 folder, the files inside are the source code of nginx1.8.0 version. The directory structure is as follows:
Nginx installation method
The configure file is an automatic script program of the Nginx software. Running configure can check the running environment and generate the required Makefile. Next, execute the following code:

<code>[root<span>@localhost</span> nginx-<span>1.8</span>.<span>0</span>]<span># ./configure --prefix=/Nginx</span></code>
Copy after login

It needs to be explained here that the option after executing configure -prefix is Specify the Nginx software installation path, readers can set it themselves.
After executing the configure file, you will get the Nginx Makefile, and then use the make command to compile:

<code>[root<span>@localhost</span> nginx-<span>1.8</span>.<span>0</span>]<span># make</span></code>
Copy after login

If no error message appears, it means that the compilation is successful and you can proceed to the next installation operation.

Note: When the author compiled here for the first time, he encountered a prompt that the pcre library was missing. Just execute yum -y install pcre pcre-devel.

Execute the make install command and install it into the system, code:

<code>[root<span>@localhost</span> nginx-<span>1.8</span>.<span>0</span>]<span># make install</span></code>
Copy after login

In order to verify whether Nginx is successfully installed, locate the current working directory to /Nginx, and you can see the following files
Nginx installation method

Note: The four directories in the above picture are As a result of compiling Nginx, a folder marked with temp will appear after the first run.

Run Nginx, the code is as follows:

<code>[root<span>@localhost</span><span>Nginx</span>]<span># ./sbin/nginx</span></code>
Copy after login

Now use the default configuration to start Nginx, open the browser, visit localhost, if you see the following web page, it means the installation is started successfully.
Nginx installation method
At this point, Nginx is installed.

').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });

The above introduces the Nginx installation method, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template