首頁 後端開發 php教程 Nginx常用指令

Nginx常用指令

Aug 08, 2016 am 09:23 AM
nbsp nginx ubuntu

1. 啟動Nginx         sudo ./sbin/nginx -s quit
-s都是採用向Nginx 發送訊號的方式。
3. Nginx 重載設定
poechant@ubuntu:sudo ./sbin/nginx -s reload
上述是採用向Nginx 發送訊號的方式,或使用:
poechant@ubuntu:service nginx reload
4. 指定檔案
4. poechant@ubuntu:sudo ./sbin/nginx -c /usr/local/nginx/conf/nginx.conf
-c表示configuration,指定設定檔。
5. 查看 Nginx 版本
有兩種可以查看 Nginx 的版本資訊的參數。第一種如下:
poechant@ubuntu:/usr/local/nginx$ ./sbin/nginx -v
nginx: nginx version: nginx/1.0.0
另一種顯示的是詳細的版本資訊:
poechant@ ubuntu:/usr/local/nginx$ ./sbin/nginx -V
nginx: nginx version: nginx/1.0.0
nginx: built by gcc 4.3.3 (Ubuntu 4.3.3-5ubpatu enabled
nginx: configure arguments: --with-http_ssl_module --with-openssl=/home/luming/openssl-1.0.0d/
6. 檢查設定檔是否正確
poechant@ubuntu:/usr/local/nginx$ . /sbin/nginx -t
nginx: [alert] could not open error log file: open() "/usr/local/nginx/logs/error.log" failed (13: Permission denied)
nginx: the configuration file// usr/local/nginx/conf/nginx.conf syntax is ok
2012/01/09 16:45:09 [emerg] 23898#0: open() "/usr/local/nginx/logs/nginx.pid" failed (13: Permission denied)
nginx: configuration file /usr/local/nginx/conf/nginx.conf
test
failed
如果出現如上的提示訊息,表示沒有存取錯誤
日誌
檔案和進程,可以sudo(super user do)一下:poerchant@ubuntu:/usr/local/nginx$ sudo ./sbin/nginx/sbin/nginx -tnginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful設定檔正確。否則,會有相關提示。 7. 顯示幫助資訊poechant@ubuntu:/user/local/nginx$ ./sbin/nginx -h
或:
poechant@ubuntu:/user/local/nginx$ ./sbin/nginx -g


[root@centos-1-22 sbin]# ./nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file/usr/local/nginx/
nginx: configuration file/usr/local/nginx/conf /nginx.conf test is successful
[root@centos-1-22 sbin]# ./nginx -h
nginx version: nginx/1.0.15 sbin]# ./nginx -h
nginx version: nginx/1.0.15
Usage: nginx [-?hvVtq] [-s signal] [-Usage: nginx [-?hvVtq] [-s signal] [- filename] [-p prefix] [-g directives]
Options:
  -?,-h         : this help
  -v         : show version and configure options then exit
  -t            : test configuration and exit
  -q            : suppress non-error messages during configuration testing
  -s signal     : send signal
  -s signal     : send signal to a master pros:  : set prefix path (default: /usr/local/nginx/ )
  -c filename   : set configuration file (default: conf/nginx.conf)
  -g directives : set global directives out of configuration file
 發送訊號的相關命令,我們會在後續看到。

以上就介紹了Nginx常用指令,包括了方面的內容,希望對PHP教學有興趣的朋友有幫助。


本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

AI Hentai Generator

AI Hentai Generator

免費產生 AI 無盡。

熱門文章

R.E.P.O.能量晶體解釋及其做什麼(黃色晶體)
3 週前 By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.最佳圖形設置
3 週前 By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.如果您聽不到任何人,如何修復音頻
3 週前 By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25:如何解鎖Myrise中的所有內容
4 週前 By 尊渡假赌尊渡假赌尊渡假赌

熱工具

記事本++7.3.1

記事本++7.3.1

好用且免費的程式碼編輯器

SublimeText3漢化版

SublimeText3漢化版

中文版,非常好用

禪工作室 13.0.1

禪工作室 13.0.1

強大的PHP整合開發環境

Dreamweaver CS6

Dreamweaver CS6

視覺化網頁開發工具

SublimeText3 Mac版

SublimeText3 Mac版

神級程式碼編輯軟體(SublimeText3)

tomcat伺服器怎麼能讓外網訪問 tomcat伺服器怎麼能讓外網訪問 Apr 21, 2024 am 07:22 AM

要讓 Tomcat 伺服器對外網訪問,需要:修改 Tomcat 設定文件,允許外部連接。新增防火牆規則,允許存取 Tomcat 伺服器連接埠。建立 DNS 記錄,將網域名稱指向 Tomcat 伺服器公有 IP。可選:使用反向代理提升安全性和效能。可選:設定 HTTPS 以提高安全性。

Android TV Box 獲得非官方 Ubuntu 24.04 升級 Android TV Box 獲得非官方 Ubuntu 24.04 升級 Sep 05, 2024 am 06:33 AM

對於許多用戶來說,破解 Android 電視盒聽起來令人畏懼。然而,在 Broadcom 晶片短缺期間,開發人員 Murray R. Van Luyn 面臨著尋找 Raspberry Pi 合適替代品的挑戰。他與 Armbia 的合作努力

Welcome to nginx!怎麼解決? Welcome to nginx!怎麼解決? Apr 17, 2024 am 05:12 AM

要解決"Welcome to nginx!" 錯誤,需要檢查虛擬主機配置,啟用虛擬主機,重新加載Nginx,如果無法找到虛擬主機配置文件,則創建預設頁面並重新加載Nginx,這樣錯誤訊息將消失,網站將正常顯示。

html檔案怎麼產生網址 html檔案怎麼產生網址 Apr 21, 2024 pm 12:57 PM

若要將 HTML 檔案轉換為網址,需要使用網頁伺服器,包括以下步驟:取得網頁伺服器。設定網路伺服器。上傳 HTML 文件。建立域名。路由請求。

nodejs專案怎麼部署到伺服器 nodejs專案怎麼部署到伺服器 Apr 21, 2024 am 04:40 AM

Node.js 專案的伺服器部署步驟:準備部署環境:取得伺服器存取權限、安裝 Node.js、設定 Git 儲存庫。建置應用程式:使用 npm run build 產生可部署程式碼和相依性。上傳程式碼到伺服器:透過 Git 或檔案傳輸協定。安裝依賴項:SSH 登入伺服器並使用 npm install 安裝應用程式相依性。啟動應用程式:使用 node index.js 等命令啟動應用程序,或使用 pm2 等進程管理器。設定反向代理(可選):使用 Nginx 或 Apache 等反向代理路由流量到應用程式

nodejs可以外網存取麼 nodejs可以外網存取麼 Apr 21, 2024 am 04:43 AM

是的,Node.js 可以外網存取。您可以使用下列方法:使用 Cloud Functions 部署函數並公開存取。使用 Express 框架建立路由並定義端點。使用 Nginx 反向代理請求到 Node.js 應用程式。使用 Docker 容器運行 Node.js 應用程式並透過連接埠映射公開。

如何使用 PHP 部署和維護網站 如何使用 PHP 部署和維護網站 May 03, 2024 am 08:54 AM

要成功部署和維護PHP網站,需要執行以下步驟:選擇Web伺服器(如Apache或Nginx)安裝PHP建立資料庫並連接PHP上傳程式碼到伺服器設定網域名稱和DNS監控網站維護步驟包括更新PHP和Web伺服器、備份網站、監控錯誤日誌和更新內容。

如何使用 Fail2Ban 保護伺服器免受暴力攻擊 如何使用 Fail2Ban 保護伺服器免受暴力攻擊 Apr 27, 2024 am 08:34 AM

Linux管理員的一個重要任務是保護伺服器免受非法攻擊或存取。預設情況下,Linux系統附有配置良好的防火牆,例如iptables、UncomplicatedFirewall(UFW),ConfigServerSecurityFirewall(CSF)等,可防止多種攻擊。任何連接到網路的機器都是惡意攻擊的潛在目標。有一個名為Fail2Ban的工具可用來緩解伺服器上的非法存取。什麼是Fail2Ban? Fail2Ban[1]是一款入侵防禦軟體,可保護伺服器免受暴力攻擊。它是用Python程式語

See all articles