Home  >  Article  >  Backend Development  >  NGINX compilation, installation and configuration

NGINX compilation, installation and configuration

WBOY
WBOYOriginal
2016-08-08 09:32:541086browse

1. Compile and install

./configure
--prefix=/usr
--sbin-path=/usr/sbin/nginx
--conf-path=/etc/nginx_1_6/nginx.conf
--error- log-path=/var/log/nginx/error.log
--http-log-path=/var/log/nginx/access.log
--pid-path=/var/run/nginx/nginx.pid
--lock-path=/var/lock/nginx.lock
--user=nginx
--group=nginx
--with-http_ssl_module
--with-http_flv_module
--with-http_stub_status_module
--with- http_gzip_static_module
--http-client-body-temp-path=/var/tmp/nginx/client/
--http-proxy-temp-path=/var/tmp/nginx/proxy/
--http-fastcgi- temp-path=/var/tmp/nginx/fcgi/
--http-uwsgi-temp-path=/var/tmp/nginx/uwsgi
--http-scgi-temp-path=/var/tmp/nginx/ scgi
--with-pcre --with-file-aio

During the compilation process, there will be a problem that the class library cannot be found. Just install the class library first and then execute it again

2. Test the NGINX environment

Execute the following statement

$ sudo /etc/init.d/nginx configtest

Seeing the following prompt means that you have all the environments to start

Testing nginx configuration: nginx.

What I encountered The error is like this

You need to add the nginx user group before starting nginx, otherwise you will be prompted

<span>[</span>emerg<span>]</span>: getpwnam<span>(</span>“nginx”<span>)</span> failed

Add user group

<span>sudo</span> adduser <span>--system</span><span>--no-create-home</span><span>--disabled-password</span><span>--group</span> nginx

Three , Start NGINX

Start NGINX

sudo /etc/init.d/nginx start

See the following prompt to indicate that the startup is successful

Starting nginx: nginx.

The above introduces the compilation, installation and configuration of NGINX, including the relevant aspects. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
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