Nginx源码安装(一个可以做反向代理的web服务器)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Nginx源码安装(一个可以做反向代理的web服务器)相关的知识,希望对你有一定的参考价值。

什么是Nginx?
1.nginx是一款轻量级可以作反向代理的web服务器.
2.Nginx占有内存少,Nginx采取了分阶段资源分配技术,使得它的CPU与内存占用率非常低。
3.抗并发能力强.处理请求是异步非阻塞的,而apache 则是阻塞型的,在高并发下nginx 能保持低资源低消耗高性能
4.高度模块化的设计,编写模块相对简单,社区活跃,各种高性能模块出品迅速
Nginx的进程问题:
Nginx至少存在两种进程,一种进程叫做Master,另一种进程叫做Worker.(一直主进程多个线程)
源码安装:
./configure \
--prefix=/usr \ --sbin-path=/usr/sbin/nginx \ --conf-path=/etc/nginx/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
#make (或者make -j 4 加快编译速度,有多少个cpu核心,就可以写多少)
#make install (程序默认被安装在/usr/local/nginx下)
语法检查是否错误:
#nginx -t
启动Nginx:
#systemctl start nginx
停止Nginx:
#sytemctl stop nginx
加载配置文件:
#systemctl reload nginx

以上是关于Nginx源码安装(一个可以做反向代理的web服务器)的主要内容,如果未能解决你的问题,请参考以下文章

lamp架构nginx简介及源码安装常用命令

lamp架构nginx简介及源码安装常用命令

学习Nginx

生产环境中nginx既做web服务又做反向代理

web服务之源码编译安装LNMP

web服务之源码编译安装LNMP