日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 运维知识 > linux >内容正文

linux

nginx linux源码编译安装,Linux源码编译安装nginx

發(fā)布時(shí)間:2024/9/15 linux 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 nginx linux源码编译安装,Linux源码编译安装nginx 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

ps:一切從簡

一、安裝所需環(huán)境:

yum -y install gcc gcc-c++ automake pcre pcre-devel zlip zlib-devel openssl openssl-devel

二、下載及安裝nginx

1.下載nginx:wget http://nginx.org/download/nginx-1.8.1.tar.gz

2.解壓nginx: tar -xzf nginx-1.8.1.tar.gz

3.添加用戶組:groupadd www、useradd -g www www

3.編譯nginx:進(jìn)入解壓之后的目錄執(zhí)行 (這里prefix為安裝目錄)

./configure \--user=www \--group=www \--prefix=/usr/local/nginx \--with-http_ssl_module \--with-http_stub_status_module \--with-http_realip_module \--with-threads

4.安裝nginx:make && make install

(安裝完成之后:make[1]: Leaving directory `/usr/local/nginx-1.8.1')? 無傷大雅

5.驗(yàn)證是否安裝成功:/usr/local/nginx/sbin/nginx -V

輸出:

nginx version: nginx/1.8.1

built by gcc 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC)

built with OpenSSL 1.0.2k-fips? 26 Jan 2017

TLS SNI support enabled

configure arguments: --user=www --group=www --prefix=/usr/local/nginx --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-threads

三、配置nginx

vi /usr/lib/systemd/system/nginx.service

添加如下:

[Unit]

Description=nginx - high performance web server

Documentation=http://nginx.org/en/docs/

After=network.target remote-fs.target nss-lookup.target

[Service]

Type=forking

PIDFile=/usr/local/nginx/logs/nginx.pid

ExecStartPre=/usr/local/nginx/sbin/nginx -t -c /usr/local/nginx/conf/nginx.confExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

ExecReload=/bin/kill -s HUP $MAINPID

ExecStop=/bin/kill -s QUIT $MAINPID

PrivateTmp=true [Install]WantedBy=multi-user.target

執(zhí)行:

/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

啟動(dòng)nginx:

systemctl start nginx

設(shè)置開機(jī)啟動(dòng):

systemctl enable nginx

總結(jié)

以上是生活随笔為你收集整理的nginx linux源码编译安装,Linux源码编译安装nginx的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。