Linux 安裝Nginx詳細步驟

2022-07-16 09:57:08 字數 888 閱讀 5497

cd /usr/loca/src

yum install gcc

yum install pcre-devel

yum install zlib zlib-devel

yum install openssl openssl-devel

3. 安裝nginx  

cd /usrl/local 

解壓nginx包

cd /nginx

執行配置 ./configure --with-http_ssl_module

編譯安裝 make && make install

4. 啟動 進入sbin 目錄 然後執行 ./nginx

報錯:nginx: [alert] could not open error log file: open() "/usr/local/nginx/logs/error.log" failed (2: no such file or directory)2020/06/03 16:13:36 [emerg] 24173#0: open() "/usr/local/nginx/logs/access.log" failed (2: no such file or directory)

原來是沒有找到日誌目錄,解決方法 新建logs目錄。再次啟動 ./nginx

預設埠是80 訪問到,則說明安裝啟動成功。

wellcome to nginx! 

5. 其他nginx命令

./nginx -t 檢測配置檔案

./nginx -s reload 重啟

./nginx -s stop 關閉nginx

ps -ef | grep nginx 檢視nginx 程序

kill -hup [nginx主程序號(即ps命令查到的pid)] 平滑重啟

linux安裝nginx詳細過程

一 先檢查是否安裝nginx,linux安裝軟體有多種方式,沒有統一的方法,所以只能全部查詢一次 1 rpm安裝包安裝檢查方式 rpm qa grep nginx 2 yum安裝檢查方式 yum list installed grep nginx 3 自己原始碼包編譯安裝檢查方式有多種方式,下面是用...

LINUX安裝nginx詳細步驟

1.安裝依賴包 一鍵安裝需要的四個依賴 yum y install gcc zlib zlib devel pcre devel openssl openssl devel 如果zlib 安裝失敗步驟 wget tar zxf zlib 1.2.11.tar.gz configure make ma...

Linux安裝nginx詳細步驟

1 依賴包 7.tar.gz3 安裝 進入目錄 cd nginx 1.13 7 執行命令 configure 執行make命令 make 執行make install命令 make install4 配置nginx.conf 開啟配置檔案 vi nginx conf nginx.conf 修改ngi...