CentOS7用tar.gz的方式安裝nginx


 

軟件:VMware 12

系統:CentOS 7

 

1.安裝開發工具包

[root@localhost ~]# yum groups mark install 'Development Tools'
[root@localhost ~]# yum -y install wget bzip2 bzip2-devel gcc gcc-c++

 

2.創建系統用戶ngin

[root@localhost ~]# groupadd -r nginx
[root@localhost ~]#  useradd -r -s /sbin/nologin -M -g nginx nginx

 

3.安裝依賴環境

 

[root@localhost ~]#yum -y install pcre-devel openssl openssl-devel gd-devel

 

4.創建日志存放目錄

[root@localhost ~]# mkdir -p /var/log/nginx
[root@localhost ~]# chown -R nginx.nginx /var/log/nginx/

 

5.下載nginx

[root@localhost ~]# cd /usr/src/
[root@localhost src]# wget http://nginx.org/download/nginx-1.12.0.tar.gz

 

6.編譯安裝

[root@localhost src]# tar xf nginx-1.12.0.tar.gz

 

[root@localhost src]# cd nginx-1.12.0
[root@localhost nginx-1.12.0]# ./configure \
> --prefix=/usr/local/nginx \
> --user=nginx \
> --group=nginx \
> --with-debug \
> --with-http_ssl_module \
> --with-http_realip_module \
> --with-http_image_filter_module \
> --with-http_gunzip_module \
> --with-http_gzip_static_module \
> --with-http_stub_status_module \
> --http-log-path=/var/log/nginx/access.log \
> --error-log-path=/var/log/nginx/error.log
[root@localhost nginx-1.12.0]# make && make install

 

7.nginx安裝后配置

[root@localhost nginx-1.12.0]# echo 'export PATH=/usr/local/nginx/sbin:$PATH' > /etc/profile.d/nginx.sh
[root@localhost nginx-1.12.0]# . /etc/profile.d/nginx.sh 

 

8.啟動

[root@localhost ~]# nginx

 

 

 

參考文檔:https://blog.csdn.net/weixin_44437026/article/details/88066510

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM