lnmp 使用手冊

官方使用手冊(https://github.com/licess/lnmp)


LNMP一鍵安裝包 –?Readme

?sudo ?/etc/init.d/php-fpm restart修改php.ini后重啟php-fpm

sudo nginx -t 測試服務器

sudo nginx -s reload 重載配置文件

/etc/hosts 解析ip

cd /usr/local/nginx/conf/vhost/ 虛擬主機配置文件

LNMP一鍵安裝包是什么?

LNMP一鍵安裝包是一個用Linux Shell編寫的可以為CentOS/RHEL/Fedora/Aliyun/Amazon、Debian/Ubuntu/Raspbian/Deepin/Mint Linux VPS或獨立主機安裝LNMP(Nginx/MySQL/PHP)、LNMPA(Nginx/MySQL/PHP/Apache)、LAMP(Apache/MySQL/PHP)生產環境的Shell程序。

LNMP一鍵安裝包有哪些功能?

支持自定義Nginx、PHP編譯參數及網站和數據庫目錄、支持生成LetseEcrypt證書、LNMP模式支持多PHP版本、支持單獨安裝Nginx/MySQL/MariaDB/Pureftpd服務器,同時提供一些實用的輔助工具如:虛擬主機管理、FTP用戶管理、Nginx、MySQL/MariaDB、PHP的升級、常用緩存組件Redis/Xcache等的安裝、重置MySQL root密碼、502自動重啟、日志切割、SSH防護DenyHosts/Fail2Ban、備份等許多實用腳本。

[if !supportLists]?[endif]LNMP官網:https://lnmp.org

[if !supportLists]?[endif]作者: licessadmin@lnmp.org

[if !supportLists]?[endif]問題反饋&技術支持論壇:https://bbs.vpser.net/forum-25-1.html

[if !supportLists]?[endif]打賞捐贈:https://lnmp.org/donation.html

LNMP安裝

安裝前確認已經安裝wget命令,如提示wget: command not found ,使用yum install wget?或?apt-get install wget?命令安裝。 為防止掉線等情況,建議使用screen,可以先執行:screen -S lnmp 命令后,再執行LNMP安裝命令:?wget http://soft.vpser.net/lnmp/lnmp1.5beta.tar.gz -cO lnmp1.5beta.tar.gz && tar zxf lnmp1.5beta.tar.gz && cd lnmp1.5 && ./install.sh {lnmp|lnmpa|lamp}

如斷線可使用screen -r lnmp?恢復。詳細安裝教程參考:https://lnmp.org/install.html

常用功能說明

以下操作需在lnmp安裝包目錄下執行,如lnmp1.5

自定義參數

lnmp.conf配置文件,可以修改lnmp.conf自定義下載服務器地址、網站/數據庫目錄及添加nginx模塊和php編譯參數;不論安裝升級都會調用該文件里的設置(如果修改了默認的參數建議備份此文件);

FTP服務器

執行:./pureftpd.sh?安裝,可使用?lnmp ftp {add|list|del}?進行管理。

升級腳本:

執行:./upgrade.sh?按提示進行選擇 也可以直接帶參數:./upgrade.sh {nginx|mysql|mariadb|php|phpa|m2m|phpmyadmin}

[if !supportLists]?[endif]參數: nginx 可升級至任意Nginx版本。

[if !supportLists]?[endif]參數: mysql 可升級至任意MySQL版本,MySQL升級風險較大,雖然會自動備份數據,依然建議自行再備份一下。

[if !supportLists]?[endif]參數: mariadb 可升級已安裝的Mariadb,雖然會自動備份數據,依然建議自行再備份一下。

[if !supportLists]?[endif]參數: m2m 可從MySQL升級至Mariadb,雖然會自動備份數據,依然建議自行再備份一下。

[if !supportLists]?[endif]參數: php 僅適用于LNMP,可升級至大部分PHP版本。

[if !supportLists]?[endif]參數: phpa 可升級LNMPA/LAMP的PHP至大部分版本。

[if !supportLists]?[endif]參數: phpmyadmin 可升級phpMyadmin。

擴展插件

執行:./addons.sh {install|uninstall} {eaccelerator|xcache|memcached|opcache|redis|apcu|imagemagick|ioncube}以下為擴展插件安裝使用說明

緩存加速:

[if !supportLists]?[endif]參數: xcache 安裝時需選擇版本和設置密碼,http://yourIP/xcache/?進行管理,用戶名 admin,密碼為安裝xcache時設置的。

[if !supportLists]?[endif]參數: redis 安裝redis

[if !supportLists]?[endif]參數: memcached 可選擇php-memcache或php-memcached擴展。

[if !supportLists]?[endif]參數: opcache 可訪問http://yourIP/ocp.php?進行管理。

[if !supportLists]?[endif]參數: eaccelerator 安裝。

[if !supportLists]?[endif]參數: apcu 安裝apcu php擴展,支持php7,可訪問http://yourIP/apc.php?進行管理。?請勿安裝多個緩存類擴展模塊,多個可能導致網站出現問題!

圖像處理:

[if !supportLists]?[endif]imageMagick安裝卸載執行:./addons.sh {install|uninstall} imageMagick?imageMagick路徑:/usr/local/imagemagick/bin/。

解密:

[if !supportLists]?[endif]IonCube安裝執行:./addons.sh {install|uninstall} ionCube。

其他常用腳本:

[if !supportLists]?[endif]可選1,多PHP版本安裝執行:./install.sh mphp?可以安裝多個PHP版本 ,只支持LNMP模式,lnmp vhost add時進行選擇或使用時需要將nginx虛擬主機配置文件里的include enable-php.conf替換為 include enable-php5.6.conf 即可前面的5.6換成你剛才安裝的PHP的大版本號5.* 或7.0之類的。

[if !supportLists]?[endif]可選2,數據庫安裝執行:./install.sh db?可以直接單獨安裝MySQL或MariaDB數據庫。

[if !supportLists]?[endif]可選3,Nginx安裝執行:./install.sh nginx可以直接單獨安裝Nginx。以下工具在lnmp安裝包tools目錄下可拷貝到其他目錄下運行

[if !supportLists]?[endif]可選4,執行:./reset_mysql_root_password.sh?可重置MySQL/MariaDB的root密碼。

[if !supportLists]?[endif]可選5,執行:./check502.sh?可檢測php-fpm是否掛掉,502報錯時重啟,配合crontab使用。

[if !supportLists]?[endif]可選6,執行:./cut_nginx_logs.sh?日志切割腳本。

[if !supportLists]?[endif]可選7,執行:./remove_disable_function.sh?運行此腳本可刪掉禁用函數。

無人值守安裝

[if !supportLists]?[endif]設置如下環境變量即可完全無人值守安裝

變量名變量值含義

LNMP_Auto啟用無人值守自動安裝

DBSelect數據庫版本序號

DB_Root_Password數據庫root密碼(不可為空),不安裝數據庫時可不加該參數

InstallInnodb是否安裝Innodb引擎,y 或 n ,不安裝數據庫時可不加該參數

PHPSelectPHP版本序號

SelectMalloc內存分配器版本序號

ApacheSelectApache版本序號,僅LNMPA和LAMP模式需添加該參數

ServerAdmin管理員郵箱,僅LNMPA和LAMP模式需添加該參數

[if !supportLists]?[endif]各程序版本對應序號

MySQL版本對應序號PHP版本對應序號內存分配器對應序號Apache版本對應序號

MySQL 5.11PHP 5.21不安裝1Apache 2.21

MySQL 5.52PHP 5.32Jemalloc2Apache 2.42

MySQL 5.63PHP 5.43TCMalloc3??

MySQL 5.74PHP 5.54????

MariaDB 5.55PHP 5.65????

MariaDB 10.06PHP 7.06????

MariaDB 10.17PHP 7.17????

MariaDB 10.28PHP 7.28????

不安裝數據庫0??????

[if !supportLists]?[endif]以LNMP模式,默認選項安裝MySQL 5.5、MySQL root密碼設置為lnmp.org、啟用InnoDB、PHP 5.6、不安裝內存分配器為例,先執行(建議先運行screen),再下載解壓lnmp安裝包:

wget http://soft.vpser.net/lnmp/lnmp1.5beta.tar.gz -cO lnmp1.5beta.tar.gz && tar zxf lnmp1.5beta.tar.gz && cd lnmp1.5

然后設置無人值守參數并安裝:

LNMP_Auto="y" DBSelect="2" DB_Root_Password="lnmp.org" InstallInnodb="y" PHPSelect="5" SelectMalloc="1" ./install.sh lnmp

(如果缺失參數的話還是會有要求選擇缺失選項的提示)。

卸載

[if !supportLists]?[endif]卸載LNMP、LNMPA或LAMP可執行:./uninstall.sh?按提示選擇即可卸載。

狀態管理

[if !supportLists]?[endif]LNMP/LNMPA/LMAP狀態管理:lnmp {start|stop|reload|restart|kill|status}

[if !supportLists]?[endif]Nginx狀態管理:lnmp nginx或/etc/init.d/nginx {start|stop|reload|restart}

[if !supportLists]?[endif]MySQL狀態管理:lnmp mysql或/etc/init.d/mysql {start|stop|restart|reload|force-reload|status}

[if !supportLists]?[endif]MariaDB狀態管理:lnmp mariadb或/etc/init.d/mariadb {start|stop|restart|reload|force-reload|status}

[if !supportLists]?[endif]PHP-FPM狀態管理:lnmp php-fpm或/etc/init.d/php-fpm {start|stop|quit|restart|reload|logrotate}

[if !supportLists]?[endif]PureFTPd狀態管理:lnmp pureftpd或/etc/init.d/pureftpd {start|stop|restart|kill|status}

[if !supportLists]?[endif]Apache狀態管理:lnmp httpd或/etc/init.d/httpd {start|stop|restart|graceful|graceful-stop|configtest|status}

虛擬主機管理

[if !supportLists]?[endif]添加:lnmp vhost add

[if !supportLists]?[endif]刪除:lnmp vhost del

[if !supportLists]?[endif]列出:lnmp vhost list

[if !supportLists]?[endif]數據庫管理:lnmp database {add|list|edit|del}

[if !supportLists]?[endif]FTP用戶管理:lnmp ftp {add|list|edit|del|show}

[if !supportLists]?[endif]SSL添加:lnmp ssl add

[if !supportLists]?[endif]通配符/泛域名SSL添加:lnmp dnsssl {cx|ali|cf|dp|he|gd|aws}?需依賴域名dns api

相關圖形界面

[if !supportLists]?[endif]PHPMyAdmin:http://yourIP/phpmyadmin/

[if !supportLists]?[endif]phpinfo:http://yourIP/phpinfo.php

[if !supportLists]?[endif]PHP探針:http://yourIP/p.php

[if !supportLists]?[endif]Xcache管理界面:http://yourIP/xcache/

[if !supportLists]?[endif]Zend Opcache管理界面:http://yourIP/ocp.php

[if !supportLists]?[endif]apcu管理界面:http://yourIP/apc.php

LNMP相關目錄文件

目錄位置

[if !supportLists]?[endif]Nginx:/usr/local/nginx/

[if !supportLists]?[endif]MySQL:/usr/local/mysql/

[if !supportLists]?[endif]MariaDB:/usr/local/mariadb/

[if !supportLists]?[endif]PHP:/usr/local/php/

[if !supportLists]?[endif]多PHP目錄:/usr/local/php5.6/ 版本號隨安裝版本不同而不同

[if !supportLists]?[endif]PHP擴展插件配置文件目錄:/usr/local/php/conf.d/

[if !supportLists]?[endif]PHPMyAdmin:/home/wwwroot/default/phpmyadmin/

[if !supportLists]?[endif]默認虛擬主機網站目錄:/home/wwwroot/default/

[if !supportLists]?[endif]Nginx日志目錄:/home/wwwlogs/

配置文件:

[if !supportLists]?[endif]Nginx主配置文件:/usr/local/nginx/conf/nginx.conf

[if !supportLists]?[endif]MySQL/MariaDB配置文件:/etc/my.cnf

[if !supportLists]?[endif]PHP配置文件:/usr/local/php/etc/php.ini

[if !supportLists]?[endif]PHP-FPM配置文件:/usr/local/php/etc/php-fpm.conf

[if !supportLists]?[endif]PureFtpd配置文件:/usr/local/pureftpd/etc/pure-ftpd.conf

[if !supportLists]?[endif]Apache配置文件:/usr/local/apache/conf/httpd.conf

lnmp.conf 配置文件參數說明

參數名稱參數介紹例子

Download_Mirror下載鏡像一般默認,如異常可修改下載鏡像

Nginx_Modules_Options添加Nginx模塊或其他編譯參數--add-module=/第三方模塊源碼目錄

PHP_Modules_Options添加PHP模塊或編譯參數--enable-exif 有些模塊需提前安裝好依賴包

MySQL_Data_DirMySQL數據庫目錄設置默認/usr/local/mysql/var

MariaDB_Data_DirMariaDB數據庫目錄設置默認/usr/local/mariadb/var

Default_Website_Dir默認虛擬主機網站目錄位置默認/home/wwwroot/default

Enable_Nginx_OpensslNginx是否使用新版openssl默認 y,建議不修改,y是啟用并開啟到http2

Enable_PHP_Fileinfo是否安裝開啟php的fileinfo模塊默認n,根據自己情況而定,安裝啟用的話改成 y

Enable_Nginx_Lua是否為Nginx安裝lua支持默認n,安裝lua可以使用一些基于lua的waf網站防火墻

技術支持

技術支持論壇:https://bbs.vpser.net/forum-25-1.html

?

?/usr/local/nginx/sbin/nginx -t 測試配置文件是否錯誤

chattr?-i?/home/wwwroot/yoursite/.user.ini? 不能刪除user.ini時使用

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。
  • 序言:七十年代末,一起剝皮案震驚了整個濱河市,隨后出現的幾起案子,更是在濱河造成了極大的恐慌,老刑警劉巖,帶你破解...
    沈念sama閱讀 229,763評論 6 539
  • 序言:濱河連續發生了三起死亡事件,死亡現場離奇詭異,居然都是意外死亡,警方通過查閱死者的電腦和手機,發現死者居然都...
    沈念sama閱讀 99,238評論 3 428
  • 文/潘曉璐 我一進店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人,你說我怎么就攤上這事。” “怎么了?”我有些...
    開封第一講書人閱讀 177,823評論 0 383
  • 文/不壞的土叔 我叫張陵,是天一觀的道長。 經常有香客問我,道長,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 63,604評論 1 317
  • 正文 為了忘掉前任,我火速辦了婚禮,結果婚禮上,老公的妹妹穿的比我還像新娘。我一直安慰自己,他們只是感情好,可當我...
    茶點故事閱讀 72,339評論 6 410
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著,像睡著了一般。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發上,一...
    開封第一講書人閱讀 55,713評論 1 328
  • 那天,我揣著相機與錄音,去河邊找鬼。 笑死,一個胖子當著我的面吹牛,可吹牛的內容都是我干的。 我是一名探鬼主播,決...
    沈念sama閱讀 43,712評論 3 445
  • 文/蒼蘭香墨 我猛地睜開眼,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了?” 一聲冷哼從身側響起,我...
    開封第一講書人閱讀 42,893評論 0 289
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后,有當地人在樹林里發現了一具尸體,經...
    沈念sama閱讀 49,448評論 1 335
  • 正文 獨居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內容為張勛視角 年9月15日...
    茶點故事閱讀 41,201評論 3 357
  • 正文 我和宋清朗相戀三年,在試婚紗的時候發現自己被綠了。 大學時的朋友給我發了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 43,397評論 1 372
  • 序言:一個原本活蹦亂跳的男人離奇死亡,死狀恐怖,靈堂內的尸體忽然破棺而出,到底是詐尸還是另有隱情,我是刑警寧澤,帶...
    沈念sama閱讀 38,944評論 5 363
  • 正文 年R本政府宣布,位于F島的核電站,受9級特大地震影響,放射性物質發生泄漏。R本人自食惡果不足惜,卻給世界環境...
    茶點故事閱讀 44,631評論 3 348
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧,春花似錦、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 35,033評論 0 28
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至,卻和暖如春,著一層夾襖步出監牢的瞬間,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 36,321評論 1 293
  • 我被黑心中介騙來泰國打工, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留,地道東北人。 一個月前我還...
    沈念sama閱讀 52,128評論 3 398
  • 正文 我出身青樓,卻偏偏與公主長得像,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個殘疾皇子,可洞房花燭夜當晚...
    茶點故事閱讀 48,347評論 2 377

推薦閱讀更多精彩內容

  • 下文來自 https://lnmp.org/ LNMP一鍵安裝包是什么? LNMP一鍵安裝包是一個用Linux S...
    swoft_閱讀 397評論 0 1
  • 一湖夏荷 惺忪著眼 躲在田田的荷葉間 是因為陽光太暖 還是想藏起你羞澀的臉 小舟輕推湖面 漣漪蕩漾 那朵初荷的心 ...
    開心果_6e66閱讀 105評論 0 0
  • swtich組件: colornametype:switchbindChange checkbox 組件: col...
    多佳小昕閱讀 118評論 0 0
  • 只要你想要,并付諸行動,原來是沒有想象中的那么難。一切真是有可能。好比,8分鐘內完成一頓早餐。今日早晨起床后發現已...
    一張紙一支筆閱讀 135評論 0 0
  • 楊倩,焦點講師三期,漯河,堅持分享294天,(2017-10-20) 今天在高自考監考培訓時謝校長講到了...
    溫心怡然閱讀 377評論 0 0