linux下安裝nginx詳情,linuxnginx詳情

來源:互聯網
上載者:User

linux下安裝nginx詳情,linuxnginx詳情

inux版本:CentOS7 64位

在安裝nginx前首先要確認系統中安裝了gcc、pcre-devel、zlib-devel、openssl-devel。

Linux下檢查是否安裝過某軟體包

安裝命令:

yum -y install gcc pcre-devel zlib-devel openssl openssl-devel

下載“nginx-1.9.9.tar.gz”,移動到/usr/local/下。

## 解壓tar -zxvf nginx-1.9.9.tar.gz##進入nginx目錄cd nginx-1.9.9
## 配置./configure --prefix=/usr/local/nginx# makemakemake install

OK,現在可以執行make 了。

執行make、make install命令

測試是否安裝成功

# cd到剛才配置的安裝目錄/usr/loca/nginx/./sbin/nginx -t

錯誤資訊:

nginx: [alert] could not open error log file: open() "/usr/local/nginx/logs/error.log" failed (2: No such file or directory)
2016/09/13 19:08:56 [emerg] 6996#0: open() "/usr/local/nginx/logs/access.log" failed (2: No such file or directory)

原因分析:nginx/目錄下沒有logs檔案夾

解決方案:

mkdir logschmod 700 logs

正常情況的資訊輸出:

nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

啟動nginx

cd /usr/local/nginx/sbin./nginx //啟動nginx

在瀏覽器中輸入伺服器的ip地址,如:192.168.1.12

如果打不開,可能是80連接埠防火牆未開放

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.