linux中查看nginx、apache、php、mysql設定檔路徑的方法

來源:互聯網
上載者:User

標籤:

原文:http://www.phper163.com/archives/368

 

如何在linux中查看nginx、apache、php、mysql設定檔路徑了,如果你接收一個別人配置過的環境,但沒留下相關文檔。這時該怎麼判斷找到正確的負載檔案路徑了。可以通過以下來判斷
1、判斷apache
首先執行命令找到httpd路徑
ps aux | grep httpd
如httpd路徑為 /usr/local/apache/bin/httpd
然後執行以下命令
/usr/local/apache/bin/httpd -V | grep “SERVER_CONFIG_FILE”
即可找到編譯時間載入的設定檔路徑 httpd.conf
-V 參數可以看到編譯時間配置的參數

2、判斷nginx
首先執行命令找到nginx路徑
ps aux | grep nginx
如nginx路徑為
/usr/local/nginx/sbin/nginx

然後執行以下命令
/usr/local/nginx/sbin/nginx -V
預設放在 安裝目錄下 conf/nginx.conf
3、判斷mysql
首先執行命令找到mysql路徑
ps aux | grep mysqld
如mysqld路徑為
/usr/bin/mysql

然後執行以下命令
/usr/bin/mysql –verbose –help | grep -A 1 ‘Default options’

/usr/bin/mysql –print-defaults

4、判斷php載入的設定檔路徑
(1)、可通過php函數phpinfo來查看,寫個檔案,然後用網址訪問一下,尋找“Loaded Configuration File”對應的值即為php載入的設定檔
(2)、如果是nginx+php配置,也可以通過尋找php執行路徑
ps aux | grep php
如,路徑為 /usr/local/nginx/sbin/php-fpm
然後執行以下命令
/usr/local/nginx/sbin/php-fpm -i | grep “Loaded Configuration File”
即可看到php載入的設定檔
(3)、如果是apache+mod_php配置,也可以在apache設定檔中查看載入的php.ini路徑。如 PHPIniDir “/usr/local/apache/conf/php.ini”

當然也有簡單的方法,就是通過find來搜尋

find / -name nginx.conf
find / -name php.ini
find / -name my.cnf
find / -name httpd.conf

這種找法要經過刷選才行

linux中查看nginx、apache、php、mysql設定檔路徑的方法

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.