1. 程式人生 > >Nginx源碼安裝(一個可以做反向代理的web服務器)

Nginx源碼安裝(一個可以做反向代理的web服務器)

Nginx

什麽是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服務器)