簡單指南:在Linux上安裝Nginx
安裝必須依賴
yum -y install make zlib zlib-devel gcc-c++ libtool openssl openssl-devel
PCRE安裝
下載依賴文件
下載 PCRE 安裝包,下載地址: http://downloads.sourceforge.net/project/pcre/pcre/8.45/pcre-8.45.tar.gz
解壓文件
[root@ebs-135816 opt]# tar -zxvf pcre-8.45.tar.gz
編譯
登錄后復制
[root@ebs-135816 pcre-8.45]# ./configure [root@ebs-135816 pcre-8.45]# make [root@ebs-135816 pcre-8.45]# sudo make install
查看版本
[root@ebs-135816 nginx-1.22.1]# pcre-config --version 8.45 [root@ebs-135816 nginx-1.22.1]#
Nginx安裝
下載nginx http://nginx.org/download/nginx-1.6.2.tar.gz
解壓
[root@ebs-135816 home]# tar -zxvf nginx-1.22.1.tar.gz
編譯
[root@ebs-135816 home]# cd nginx-1.22.1/ [root@ebs-135816 nginx-1.22.1]# ls auto CHANGES CHANGES.ru conf configure contrib html LICENSE man README src [root@ebs-135816 nginx-1.22.1]# ./configure --prefix=/home/nginx-1.22.1 --with-http_stub_status_module --with-http_ssl_module --with-pcre=/opt/pcre-8.45
[root@ebs-135816 nginx-1.22.1]# make
驗證配置
[root@ebs-135816 nginx-1.22.1]# mkdir logs [root@ebs-135816 nginx-1.22.1]# ./sbin/nginx -t nginx: the configuration file /home/nginx-1.22.1/conf/nginx.conf syntax is ok nginx: configuration file /home/nginx-1.22.1/conf/nginx.conf test is successful [root@ebs-135816 nginx-1.22.1]#
啟動服務
[julong@localhost nginx]$ ./sbin/nginx 在網(wǎng)頁試著訪問下http://192.168.1.222:9090/ ./sbin/nginx -s reload # 重新載入配置文件 ./sbin/nginx -s reopen # 重啟 Nginx ./sbin/nginx -s stop # 停止 Nginx
本文詳細介紹了在Linux系統(tǒng)下安裝Nginx的步驟。首先,我們通過包管理器安裝Nginx,并啟動Nginx服務。然后,我們介紹了如何進行基本的配置,包括修改默認網(wǎng)站目錄、配置虛擬主機和HTTPS等。最后,我們還介紹了如何啟用Nginx的gzip壓縮和緩存功能,以提高網(wǎng)站的性能。通過本文的指導,讀者可以輕松地在Linux系統(tǒng)上安裝和配置Nginx,為自己的網(wǎng)站和應用程序提供高性能的服務。
到此這篇關于簡單指南:在Linux上安裝Nginx的文章就介紹到這了,更多相關linux下安裝nginx內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持腳本之家!
相關文章
采用ngxtop實現(xiàn)nginx實時訪問數(shù)據(jù)統(tǒng)計
這篇文章主要介紹了采用ngxtop實現(xiàn)nginx實時訪問數(shù)據(jù)統(tǒng)計,需要的朋友可以參考下2014-07-07nginx訪問日志并刪除指定天數(shù)前的日志記錄配置方法
這篇文章主要介紹了nginx訪問日志并刪除指定天數(shù)前的日志記錄配置方法,需要的朋友可以參考下2014-03-03