Nginx
下载
wget -c http://nginx.org/download/nginx-1.10.3.tar.gz
/usr/local/src
groupadd nginx
useradd -g nginx -M nginx
不为nginx建立home目录
vim /etc/passwd
修改nginx:x:1001:1001::/home/nginx:/bin/***nologin***
配置、编译、安装
./configure --prefix=/usr/local/nginx
–pid-path=/usr/local/nginx/run/nginx.pid
–with-http_ssl_module
–user=nginx
–group=nginx
–with-pcre
–without-mail_pop3_module
–without-mail_imap_module
–without-mail_smtp_module
报错
./configure: error: the HTTP rewrite module requires the PCRE library.
安装pcre-devel解决问题
yum -y install pcre-devel
错误提示:./configure: error: the HTTP cache module requires md5 functions
from OpenSSL library. You can either disable the module by using
–without-http-cache option, or install the OpenSSL library into the system,
or build the OpenSSL library statically from the source with nginx by using
–with-http_ssl_module --with-openssl=
解决办法:
yum -y install openssl openssl-devel
make
make install
nginx -v
nginx -t
启动:
nginx
ps -ef | grep ngix
从容重启
kill -QUIT 主进程号
快速停止
kill -TERM 主进程号
强制停止
kill -9 nginx
平滑重启
nginx -s reload
简单配置:
server{
listen 80;
server_name 域名;
location / {
proxy_pass localhost:8080;
index index.html index.htm;
}
}