日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

LNMP环境的搭建

發布時間:2025/3/20 编程问答 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 LNMP环境的搭建 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.



1. MySQL安裝(同LAMP 里面的安裝方法)
2.??php
安裝
wget??
http://cn2.php.net/distributions/php-5.4.37.tar.bz2
tar jxf php-5.4.37.tar.bz2
useradd -s /sbin/nologin php-fpm?
cd php-5.4.37
如果你不想這個覆蓋你的 lampphp 你可以在 —prefix這里定義一個新的目錄)

./configure --prefix=/usr/local/php2? ?--with-config-file-path=/usr/local/php/etc??--enable-fpm? ?--with-fpm-user=php-fpm??--with-fpm-group=php-fpm? ?--with-mysql=/usr/local/mysql??--with-mysql-sock=/tmp/mysql.sock??--with-libxml-dir??--with-gd? ?--with-jpeg-dir? ?--with-png-dir? ?--with-freetype-dir??--with-iconv-dir? ?--with-zlib-dir? ?--with-mcrypt? ?--enable-soap? ?--enable-gd-native-ttf? ?--enable-ftp??--enable-mbstring??--enable-exif? ? --disable-ipv6? ???--with-curl?


如果出現錯誤: checking for cURL in default path... not found
configure: error: Please reinstall the libcurl distribution -

easy.h should be in /include/curl/

則安裝這個 yum -y install curl-devel即可解決


make && make install?


拷貝啟動腳本:
cp /usr/local/src/php-5.4.37/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm?
mv /usr/local/php2/etc/php-fpm.conf.default??/usr/local/php2/etc/php-fpm.conf
chmod 755 /etc/init.d/php-fpm?
chkconfig --add php-fpm
service php-fpm start?
chkconfig php-fpm on?

3 nginx的安裝

cd /usr/local/src/
wget?http://nginx.org/download/nginx-1.6.2.tar.gz
tar zxvf nginx-1.6.2.tar.gz?
cd nginx-1.6.2

./configure? ?--prefix=/usr/local/nginx? ?--with-pcre?

如果這一步報錯提示 ./configure: error: the HTTP rewrite module requires the PCRE library.

則可以安裝 yum -y install pcre-devel 解決問題

make?
make install

啟動nginx:??
/usr/local/nginx/sbin/nginx

加上-t ?可以檢查配置文件是否正確

4 設置解析php文件

. 配置解析php

vim??/usr/local/nginx/conf/nginx.conf? ?//把下面的配置,前面的#刪除, 并更改fastcgi_param SCRIPT_FILENAME 那一行

??????? location ~ \.php$ {
??????????? root?????????? html;
??????????? fastcgi_pass?? 127.0.0.1:9000;
??????????? fastcgi_index? index.php;
??????????? fastcgi_param? SCRIPT_FILENAME? /usr/local/nginx/html$fastcgi_script_name;
??????????? include??????? fastcgi_params;

??????? }

重新加載 /usr/local/nginx/sbin/nginx -s??reload
?檢查配置文件/usr/local/nginx/sbin/nginx -t
最后可以成功解析php ?
如果想關閉nginx的服務可以 killall -9 nginx

注意:如果這里拒接訪問,可能是php.ini這個配置文件里設置了open_basdir


測試能否正常解析php文件,寫一個php文件


vim??/usr/local/nginx/html/1.php?
增加??
<?php
? ? phpinfo();
?>

然后,在瀏覽器中輸入http://ip/1.php?看能否訪問,如果正常,則lnmp搭建成功


轉載于:https://blog.51cto.com/825536458/1702441

總結

以上是生活随笔為你收集整理的LNMP环境的搭建的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。