LNMP組合詳解與實戰
二進位制包才可以直接安裝,普通包只能編譯安裝。
採用二進位制包安裝mysql:
1、直接解壓 tar xf mysql-5.5.32-linux2.6-x86_64.tar.gz
2、 mv mysql-5.5.32-linux2.6-x86_64 /application/mysql
3、useradd mysql -s /sbin/nologin -M
4、chown -R mysql.mysql /application/mysql/data
5、/application/mysql/scripts/mysql_install_db –user=mysql –basedir=/application/mysql/ –datadir=/application/mysql/data
6、cp support-files/mysql.server /etc/init.d/mysqld
7、vi /etc/init.d/mysqld將basedir和datadir修改成本機的路徑
8、cp support-files/my-small.cnf /etc/my.cnf
9、vi /etc/profile新增/application/mysql/bin/
/application/mysql//bin/mysqladmin -u root -h mysql1.cn password
載入環境變數,可以加在/etc/profile/或/usr/local/sbin/
如報錯/tmp locaking之類的按如下處理:
chmod -R 4777 /tmp
LNMP下的php
apache——-libphp5.so
nginx php———fcgi php-fpm port 9000
yum install zlib libxml libjpeg freetype libpng gd curl libiconv zlib-devel libxml2-devel libjpeg-devel freetype-devel libpng-devel gd-devel curl-devel -y
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
tar xf libiconv-1.14.tar.gz
cd libiconv-1.14
./configure –prefix=/usr/local/libiconv
make&&make install
tar xf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure
make&&make install
sleep 2
/sbin/ldconfig
cd libltdl/
./configure –enable-ltdl-install
make&&make install
cd ../../
tar xf mhash-0.9.9.9.9.tar.gz
cd mhash-0.9.9.9.9
./configure
make&&make install
sleep 2
cd ../
rm -f /usr/lib64/libmcrypt.*
rm -f /usr/lib64/libmhash.*
rm -f /usr/local/lib64/libmcrypt.la /usr/lib64/libmcrypt.la
rm -f /usr/local/lib64/libmcrypt.*so /usr/lib64/libmcrypt.so
rm -f /usr/local/lib64/libmcrypt.*so.4 /usr/lib64/libmcrypt.so.4
rm -f /usr/local/lib64/libmcrypt.so.4.4.8 /usr/lib64/libmcrypt.so.4.4.8
rm -f /usr/local/lib64/libmhash.a /usr/lib64/libmhash.a
rm -f /usr/local/lib64/libmhash.la /usr/lib64/libmhash.la
rm -f /usr/local/lib64/libmhash.so /usr/lib64/libmhash.so
rm -f /usr/local/lib64/libmhash.so.2 /usr/lib64/libmhash.so.2
rm -f /usr/local/lib64/libmhash.so.2.0.1 /usr/lib64/libmhash.so.2.0.1
rm -f /usr/local/lib64/libmcrypt-config /usr/bin/libmcrypt-config
tar xf mcrypt-2.6.8.tar.gz
cd mcrypt-2.6.8/
/sbin/ldconfig
./configure LD_LIBRARY_PATH=/usr/local/lib
make&&make install
cd ../
sleep 2
開始安裝php:
yum install libxslt* -y
./configure
–prefix=/application/php5.3.27
–with-mysql=/application/mysql
–with-iconv-dir=/usr/local/libiconv
–with-freetype-dir
–with-jpeg-dir
–with-png-dir
–with-zlib
–with-libxml-dir=/usr
–enable-xml
–disable-rpath
–enable-safe-mode
–enable-bcmath
–enable-shmop
–enable-sysvsem
–enable-inline-optimization
–with-curl
–with-curlwrappers
–enable-mbregex
–enable-fpm
–enable-mbstring
–with-mcrypt
–with-gd
–enable-gd-native-ttf
–with-openssl
–with-mhash
–enable-pcntl
–enable-sockets
–with-xmlrpc
–enable-zip
–enable-soap
–enable-short-tags
–enable-zend-multibyte
–enable-static
–with-xsl
–with-fpm-user=nginx
–with-fpm-group=nginx
–enable-ftp
會報個錯:
ln -s /application/mysql/lib/libmysqlclient.so.18 /usr/lib64/
make&&make install
useradd nginx -s /sbin/nologin -M
cp /application/php-5.4.27/php.ini-production /application/php/lib/php.ini
mkdir /app/logs -p
apache裡的php是通過模組apxs的方式新增進去的,所以沒有程式不需要啟動,而nginx裡的php是通過fcgi的方式需要程式,埠號為9000,所以得配置php-fpm然後將其啟動,配置如下:
在/application/php/etc/下:
cp php-fpm-conf.default php-fpm-conf
然後vi php-fpm-conf:
pid = /app/logs/php-fpm.pid
error_log = /app/logs/php-fpm.log
log_level = error
rlimit_files = 32768
events.mechanisn = epoll
listen.owner = nginx
listen.group = nginx
pm.max_children = 1024
pm.start_servers = 16
pm.min_spare_servers = 5
pm.max_spare_servers = 20
pm.process-idle_timeout = 15s;
pm.max_requests = 2048
slowlog = /app/logs/$pool.log.slow
request_slowlog_timeout = 10
/application/php/sbin/php-fpm -t 檢查語法
/application/php/sbin/php-fpm
將一下內容加入rc.local:
/etc/init.d/mysqld start
/application/php/sbin/php-fpm
/application/nginx/sbin/nginx
server {
listen 80;
server_name www.weipeng.com;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.php index.html index.htm;
}
location ~ .*.(php|php5)?$
{
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
/application/php/bin/php php-mysql.php 可對php檔案進行執行。
本文轉自 流顆星 51CTO部落格,原文連結:http://blog.51cto.com/liukexing/1967917
相關文章
- Numpy陣列的組合與分割詳解陣列
- CSRF 詳解與攻防實戰
- c#組合模式詳解C#模式
- js 組合繼承詳解JS繼承
- Hyperledger Fabric原理詳解與實戰1
- Hyperledger Fabric原理詳解與實戰4
- Oracle中組合索引的使用詳解Oracle索引
- CutMix&Mixup詳解與程式碼實戰
- Android 除錯實戰與原理詳解Android除錯
- 鴻蒙HarmonyOS實戰-ArkUI事件(組合手勢)鴻蒙UI事件
- Flutter完整開發實戰詳解(十六、詳解自定義佈局實戰)Flutter
- 組合數學筆記-排列與組合筆記
- 《JAVA併發程式設計實戰》物件的組合Java程式設計物件
- Flutter完整開發實戰詳解(八、 實用技巧與填坑)Flutter
- JavaScript數字和字母組合驗證碼詳解JavaScript
- iOS下JS與OC互相呼叫(八)--Cordova詳解+實戰iOSJS
- 繼承與組合繼承
- NumPy 陣列迭代與合併詳解陣列
- Spring:如何實現註解的組合Spring
- 位元組碼引用檢測原理與實戰
- Flutter完整開發實戰詳解(三、打包與填坑篇)Flutter
- 《python 爬蟲開發與實戰》html基礎詳解Python爬蟲HTML
- 實戰if-else 過多詳解
- NCNN 模型推理詳解及實戰CNN模型
- Java註解詳解「註解專案實戰」Java
- Flutter 實現webview與原生元件組合滑動FlutterWebView元件
- Flutter 入門與實戰(三十九):渲染模式詳解|8月更文挑戰Flutter模式
- 速度與精度的結合 - EfficientNet 詳解
- Gin與Mysql實現簡單Restful風格API實戰示例詳解PRHCMySqlRESTAPI
- LNMP組合工作流程是什麼?linux運維必學技能LNMPLinux運維
- Flutter完整開發實戰詳解(十五、全面理解State與Provider)FlutterIDE
- 依賴管理利器---Spring IO Platform解決Spring組合依賴問題實戰SpringPlatform
- 正規表示式詳解及實戰
- Elasticsearch使用實戰以及程式碼詳解Elasticsearch
- Web3與智慧合約互動實戰Web
- Flutter完整開發實戰詳解(二、快速開發實戰篇)Flutter
- 位元組碼詳解
- 索引與null(二):組合索引索引Null