Nginx learning ---- 1

Source: Internet
Author: User

This section focuses on:

1. Install, start, restart, and stop nginx in Linux

2. Detailed description of the configuration file

 

1. Install nginx in Linux

During J2EE development, nginx has been used for load balancing, but it has never been built from scratch. Recently, a new platform has been developed, I wanted to use nginx on my testing machine, so I built it myself and found many problems. It took a lot of time to complete the setup. Now I have recorded the process. At the beginning, I downloaded nginx-1.4.7.tar.gz from the network, put it under/usr/local/nginx, decompress it, get the nginx-1.4.7 folder, because under the window at ordinary times, developed like to use the folder name looks better, modify the nginx name of the folder and run the following command on the command line :. /configure make install. First, I reported the error of the missing package. To install nginx, I need an external package, GCC PCRE-deve SSL. Fortunately, yum is on my testing machine, run the yum command to install these packages. Then, the "/usr/local/nginx" folder is reported. At that time, I couldn't understand what was going on. I copied the reported errors to the browser for hundreds of times. Many of them were executed. /configure -- prefix =/usr/local/nginx. /configure is followed by a lot of parameters. If you try to find a few parameters, you can search for them on the Internet. Many of them point to the source code paths such as pcre ssl. I installed them all in yum, where can I find the source code path. At that time, I thought about downloading pcre ssl and installing it with the source code, but it was too lazy. I thought it would be very troublesome and I had been searching for it online for a long time. There is really no way. I thought it was impossible to install nginx. It must be my problem. I deleted the decompressed file, decompressed it again, and then executed it directly. /configure make install, to install it in a silly way in a window, the result is OK. I understood at the time that the default installation path for nginx is/usr/local/nginx. I have occupied this path and have not re-specified it. It's really stupid, it's too time-consuming to learn about Linux. It's terrible to be stupid. The following are some commands used in the process:

A. Check whether Yum is installed.
Enter yum directly in the command line. If yum is installed, the option of the yum command is displayed.

B. Check whether PCRE is installed.

Enter rpm-Qa | grep PCRE directly on the command line.

C. Check whether GCC is installed.
Enter gcc-V directly on the command line.

 

Information printed after successful execution of./configure:

  

Configuration Summary
+ Using system PCRE Library
+ OpenSSL library is not used
+ MD5: using system crypto library
+ Sha1: using system crypto library
+ Using system zlib library

Nginx path Prefix: "/usr/local/nginx"
Nginx binary file: "/usr/local/nginx/sbin/nginx"
Nginx configuration Prefix: "/usr/local/nginx/conf"
Nginx configuration file: "/usr/local/nginx/CONF/nginx. conf"
Nginx PID file: "/usr/local/nginx/logs/nginx. PID"
Nginx Error Log File: "/usr/local/nginx/logs/error. log"
Nginx HTTP access log file: "/usr/local/nginx/logs/access. log"
Nginx HTTP client request body temporary files: "client_body_temp"
Nginx HTTP Proxy temporary files: "proxy_temp"
Nginx HTTP FastCGI temporary files: "fastcgi_temp"
Nginx HTTP uwsgi temporary files: "uwsgi_temp"
Nginx HTTP scgi temporary files: "scgi_temp"

 

 

After installation, how can I check whether the installation is successful?

The nginx installation directory contains the sbin/nginx executable file, which can be started with/usr/local/nginx/sbin/nginx. Enter the IP address in the browser and press Enter. If an nginx welcome page is returned, the request is successful.

Stop command: Kill-Quit master process number

Nginx learning ---- 1

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.