centos7系統:192.168.124.204
關閉防火牆
關閉selinux
yum -y install vim wget
建立nginx使用者
useradd nginx
修改nginx使用者登陸許可權
解壓nginx包,進入安裝包目錄
[root@localhost ~]# tar xzf nginx-1.16.1.tar.gz -c /usr/local/
[root@localhost ~]# cd /usr/local/nginx-1.16.1/
然後進行編譯
–with-stream nginx1.9以下版本不支援該模組
安裝[root@localhost nginx-1.16.1]# make && make install
建立檔案目錄
[root@localhost local]# mkdir /tmp/nginx/client_body -p
設定nginx啟動指令碼
[root@localhost local]# cat /etc/init.d/nginx
#! /bin/bash
# description: startup script for webserver on centos. cp it in /etc/init.d and
# chkconfig --add nginx && chkconfig nginx on
# then you can use server command control nginx
## chkconfig: 2345 08 99
# description: starts, stops nginx
set-e
path=$path:/usr/local/nginx/sbin/
desc="nginx daemon"
name=nginx
daemon=/usr/local/nginx/sbin/
$name
configfile=/etc/nginx/nginx.conf
pidfile=/
var/run/nginx.pid
scriptname=/etc/init.d/
$name
# gracefully exit if the package has been removed.
test -x $daemon||
exit 0
d_start(
)d_stop(
)d_reload(
)case "$1" in
start
)echo
-n "starting $desc: $name"
d_start
echo
".";
;stop)
echo
-n "stopping $desc: $name"
d_stop
echo
".";
;reload)
echo
-n "reloading $desc configuration..."
d_reload
echo
"reloaded.";;
restart)
echo
-n "restarting $desc: $name"
d_stop
sleep 1
d_start
echo
".";;*
)echo
"usage: $scriptname " >&2
exit 3;;
esac
exit 0
修改nginx配置檔案
啟動nginx
[root@localhost local]# systemctl restart nginx
訪問192.168.124.204
原始碼編譯安裝Nginx
nginx在github上有乙個唯讀原始碼庫,我獲取的原始碼方式為 git clone cd nginx cp auto configure configure make sudo make install 預設安裝後nginx位於 usr local nginx 目錄下,nginx的配置檔案在 u...
nginx安裝 原始碼編譯
官方文件 參考 公升級參考 編譯原始碼需要的元件 1.zlib 2.pcre 正規表示式 3.openssl 可選 4.nginx 1.編譯zlib version 1.1.3 1.2.8 mkdir usr src zlib cd usr src zlib wget tar xvf zlib 1....
Nginx原始碼編譯及安裝
1.nginx 介紹 nginx是 http 和反向 伺服器,郵件 伺服器,以及 igor sysoev 最初編寫的通用tcp udp 伺服器。在很長一段時間以來,它一直在許多負載重的俄羅斯 上執行,包括 yandex,mail.ru,vk 和 rambler。根據netcraft的說法,nginx...