国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網(wǎng)站 > Nginx > 正文

詳解Centos7 源碼編譯安裝 Nginx1.13

2024-08-30 12:25:00
字體:
供稿:網(wǎng)友

關(guān)于nginx的相關(guān)介紹我就不說了,既然你選擇nginx作為你的web服務(wù)器,想必你多少也對nginx server有不同認(rèn)知和理解,接下來我就直接安裝。

1.先決條件:

我使用的是centos7.3 64位核心版系統(tǒng),安裝配置nginx前必須安裝nginx依賴包,請查看;Centos 7編譯安裝php7.1之生產(chǎn)篇,并安裝前文開頭所提供的依賴包。此依賴組件包適用于Nginx任意版本。

新建web用戶和組

$ /usr/sbin/groupadd www$ /usr/sbin/useradd -g www www$ ulimit -SHn 65535 //設(shè)置linux高負(fù)載參數(shù)

2.從官方下載Nginx以及OpenSSL

下載Nginx時有兩個版本:開發(fā)版和穩(wěn)定版,如果用于生產(chǎn)就下載穩(wěn)定版本,http://nginx.org/en/download.html (最好下載最新版本的穩(wěn)定版,這樣會有bug修復(fù)以及新特性)我下載的是就是目前最新版本nginx-1.13.5。

$ cd /tmp$ wget https://www.openssl.org/source/openssl-1.1.0e.tar.gz$ tar zxvf openssl-1.1.0e.tar.gz$ wget https://nginx.org/download/nginx-1.13.5.tar.gz$ tar zxvf nginx-1.13.5.tar.gz$ cd nginx-1.13.5

3.安裝Nginx

你可能會注意到有些文檔教程安裝nginx的時候,并未指派這么多模塊,(看起來好長),有的連模塊和用戶都沒有指派,其實模塊是根據(jù)自己的需要指派的, 如果想以后不麻煩,那么就按照下面的模塊指派就行了,其實這也算是全能的了,不然后期你需要什么還得重新編譯進(jìn)去,不是很麻煩,但也不省事。至于是否指派用戶組,我堅決會讓你指派,這可關(guān)乎nginx配置的可用性和安全穩(wěn)定。

$ ./configure /--prefix=/usr/local/nginx /--user=www /--group=www /--with-pcre /--with-openssl=/tmp/openssl-1.1.0e /--with-http_ssl_module /--with-http_v2_module /--with-http_realip_module /--with-http_addition_module /--with-http_sub_module /--with-http_dav_module /--with-http_flv_module /--with-http_mp4_module /--with-http_gunzip_module /--with-http_gzip_static_module /--with-http_random_index_module /--with-http_secure_link_module /--with-http_stub_status_module /--with-http_auth_request_module /--with-http_image_filter_module /--with-http_slice_module /--with-mail /--with-threads /--with-file-aio /--with-stream /--with-mail_ssl_module /--with-stream_ssl_module /
$ make -j8 && make install //編譯并安裝

4.創(chuàng)建 systemctl 系統(tǒng) Nginx 單元文件

安裝完成后還需要開機自啟動,不然每次開機都需要手動,那豈不是太麻煩。

$ vim /usr/lib/systemd/system/nginx.service[Unit]Description=The nginx HTTP and reverse proxy serverAfter=syslog.target network.target remote-fs.target nss-lookup.target[Service]Type=forkingPIDFile=/usr/local/nginx/logs/nginx.pidExecStartPre=/usr/local/nginx/sbin/nginx -tExecStart=/usr/local/nginx/sbin/nginxExecReload=/bin/kill -s HUP /usr/local/nginx/logs/nginx.pidExecStop=/bin/kill -s QUIT /usr/local/nginx/logs/nginx.pidPrivateTmp=true[Install]WantedBy=multi-user.target            
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 辽中县| 沽源县| 罗定市| 灵台县| 西青区| 宁安市| 靖江市| 广昌县| 浮梁县| 双江| 内乡县| 宝鸡市| 民县| 淄博市| 师宗县| 自贡市| 休宁县| 县级市| 长顺县| 乐安县| 武川县| 施秉县| 溧阳市| 卢氏县| 新龙县| 佛冈县| 怀化市| 安多县| 谷城县| 诸城市| 信阳市| 昭平县| 法库县| 尼玛县| 株洲县| 资阳市| 陇南市| 黔东| 黄大仙区| 辽阳市| 昌江|