91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

centos環境下lnmp怎么安裝配置

發布時間:2022-04-08 17:31:25 來源:億速云 閱讀:169 作者:iii 欄目:編程語言

這篇文章主要講解了“centos環境下lnmp怎么安裝配置”,文中的講解內容簡單清晰,易于學習與理解,下面請大家跟著小編的思路慢慢深入,一起來研究和學習“centos環境下lnmp怎么安裝配置”吧!

安裝依賴庫和開發環境

復制代碼 代碼如下:

#依賴庫和開發工具

yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers
#nginx

yum -y install pcre-devel  zlib-devel
#php

yum -y install gd-devel libjpeg-devel libpng-devel freetype-devel libxml2-devel curl-devel freetype-devel
#mysql

yum -y install bison gcc gcc-c++ autoconf automake zlib* libxml* ncurses-devel libtool-ltdl-devel* mysql-devel
下載軟件包

#創建目錄

mkdir /web

cd /web
#php5.3.8

wget http://php.net/distributions/php-5.3.8.tar.bz2
#php庫文件

wget http://ncu.dl.sourceforge.net/project/mcrypt/mcrypt/2.6.8/mcrypt-2.6.8.tar.gz

wget http://ncu.dl.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz

wget http://ncu.dl.sourceforge.net/project/mcrypt/libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz

wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
#nginx1.5.3

wget http://www.nginx.org/download/nginx-1.5.3.tar.gz
#nginx(pcre)

wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.13.tar.gz

如果沒有8.13可以這里ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/ 下載最新
#mysql5.5.17

wget http://mysql.mirrors.pair.com/downloads/mysql-5.5/mysql-5.5.32.tar.gz

下載最新的:http://mysql.mirrors.pair.com/downloads/mysql-5.5/
#mysql(cmake)

wget http://www.cmake.org/files/v2.8/cmake-2.8.6.tar.gz

安裝mysql

復制代碼 代碼如下:

#安裝cmake

tar -zxvf cmake-2.8.6.tar.gz

cd cmake-2.8.6/

./configure

gmake && gmake install  && cd ../
#添加mysql用戶

/usr/sbin/groupadd mysql

/usr/sbin/useradd -g mysql mysql

mkdir -p /data/mysql

chown -r mysql:mysql /data/mysql
#安裝mysql

tar -zxvf mysql-5.5.17.tar.gz

cd mysql-5.5.17

cmake . -dcmake_install_prefix=/usr/local/mysql -dmysql_datadir=/data/mysql -dsysconfdir=/etc/

make && make install
#設置mysql

#在support-files目錄中有五個配置信息文件:

#my-small.cnf (內存<=64m)

#my-medium.cnf (內存 128m)

#my-large.cnf (內存 512m)

#my-huge.cnf (內存 1g-2g)

#my-innodb-heavy-4g.cnf (內存 4gb)

cd /usr/local/mysql

cp ./support-files/my-medium.cnf /etc/my.cnf

vi /etc/my.cnf

#在 [mysqld] 段增加

datadir = /data/mysql

wait-timeout = 30

max_connections = 512

default-storage-engine = myisam

#在 [mysqld] 段修改

max_allowed_packet = 16m
#生成授權表

cd /usr/local/mysql

./scripts/mysql_install_db --user=mysql
#更改密碼

/usr/local/mysql/bin/mysqladmin -u root password 123456
#開啟mysql

/usr/local/mysql/bin/mysqld_safe &
#測試連接mysql

/usr/local/mysql/bin/mysql -u root -p 123456

show databases;

exit;
#設置開機啟動

vi /etc/rc.d/rc.local
#加入

/usr/local/mysql/bin/mysqld_safe &

可能出現error 2002 (hy000): can't connect to local mysql server through socket '/tmp/mysql.sock' (2)

cd /tmp //發現沒有

ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock

cd /var/run/

chown -r mysql mysqld

安裝php

復制代碼 代碼如下:

#1

tar -zxvf libiconv-1.14.tar.gz && cd libiconv-1.14/

./configure --prefix=/usr/local

make && make install && cd ../
#2

tar -zxvf libmcrypt-2.5.8.tar.gz && cd libmcrypt-2.5.8/

./configure &&  make && make install

/sbin/ldconfig && cd libltdl/ && ./configure --enable-ltdl-install

make && make install && cd ../
#3

tar -zxvf mhash-0.9.9.9.tar.gz && cd mhash-0.9.9.9/ && ./configure

make && make install && cd ../
#4

ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la

ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so

ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4

ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8

ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a

ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la

ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so

ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2

ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1

ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config
#5
tar -zxvf mcrypt-2.6.8.tar.gz &&cd mcrypt-2.6.8/

/sbin/ldconfig

./configure

make && make install && cd ../
#6
tar -xjvf php-5.3.8.tar.bz2

cd php-5.3.8
./configure --prefix=/usr/local/php \

--with-config-file-path=/usr/local/php/etc \

--with-iconv-dir=/usr/local/ --with-freetype-dir \

--with-mysql=/usr/local/mysql \

--with-mysqli=/usr/local/mysql/bin/mysql_config \

--with-jpeg-dir --with-png-dir --with-zlib \

--with-mhash --enable-sockets --enable-ftp \

--with-libxml-dir --enable-xml --disable-rpath \

--enable-safe-mode --enable-bcmath \

--enable-shmop --enable-sysvsem \

--enable-inline-optimization --with-curl \

--with-curlwrappers \

--enable-mbregex \

--enable-mbstring --with-mcrypt --with-gd \

--enable-gd-native-ttf --with-openssl --with-mhash \

--enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl \

--enable-fpm \

--with-xmlrpc --enable-zip --enable-soap \

--without-pear \

make zend_extra_libs='-liconv'

#注意這里容易出現 make: *** [ext/phar/phar.php] 錯誤 127

#出現mysql client解決方法

#ln -s /usr/local/mysql/lib/libmysqlclient.so /usr/lib/

#ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib/libmysqlclient.so.18

#或者chmod: 無法訪問 “ext/phar/phar.phar”: 沒有那個文件或目錄

#make: [ext/phar/phar.phar] 錯誤 1 (忽略)

#解決方法在編譯的時候加--without-pear參數

#如果還不行,make的時候不添加 zend_extra_libs='-liconv' 參數

make install
#選擇php.ini配置文件
cp php.ini-production /usr/local/php/etc/php.ini
更改php-fpm
#添加www用戶
/usr/sbin/groupadd www && /usr/sbin/useradd -g www www

mkdir -p /var/log/nginx && chmod +w /var/log/nginx &&chown -r www:www /var/log/nginx

mkdir -p /data/www && chmod +w /data/www && chown -r www:www /data/www

cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf

vi /usr/local/php/etc/php-fpm.conf
#去掉/更改 配置文件中的;

pm.max_children = 64

pm.start_servers = 20

pm.min_spare_servers = 5

pm.max_spare_servers = 35

pm.max_requests = 1024

user = www
group = www
#檢查語法是否正確

/usr/local/php/sbin/php-fpm -t

#出現notice: configuration file /usr/local/php/etc/php-fpm.conf test is successful 測試成功

/usr/local/php/sbin/php-fpm &

#設置開機啟動

vi /etc/rc.d/rc.local

#在行末加入

/usr/local/php/sbin/php-fpm &
#返回安裝包目錄

cd /web
安裝nginx

#安裝pcre庫

tar -zxvf pcre-8.13.tar.gz && cd pcre-8.13/ && ./configure

make && make install && cd ../
#安裝nginx

tar -zxvf nginx-1.0.9.tar.gz && cd nginx-1.0.9 &&

./configure --user=www --group=www \

--prefix=/usr/local/nginx \

--sbin-path=/usr/local/nginx/sbin/nginx \

--conf-path=/usr/local/nginx/conf/nginx.conf \

--with-http_stub_status_module \

--with-http_ssl_module \

--with-pcre \

--lock-path=/var/run/nginx.lock \

--pid-path=/var/run/nginx.pid

make && make install && cd ../
#更改配置
vi /usr/local/nginx/conf/nginx.conf
#修改一些參數,別直接替換文件,這只是一部分

復制代碼 代碼如下:

user www

events {

  use epoll;

   worker_connections  1024;

}

location ~ \.php$ {

           root           html;

           fastcgi_pass   127.0.0.1:9000;

           fastcgi_index  index.php;

           fastcgi_param  script_filename  $document_root$fastcgi_script_name;

           include        fastcgi_params;

       }

復制代碼 代碼如下:

#注意這里

#$document_root$fastcgi_script_name;

#檢測配置文件

/usr/local/nginx/sbin/nginx -t
#提示表示成功
#nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
#nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

#開啟nginx

/usr/local/nginx/sbin/nginx &
#平滑重啟nginx

/usr/local/nginx/sbin/nginx -s reload
#添加開機啟動

vi /etc/rc.d/rc.local
#最后移行加入

/usr/local/nginx/sbin/nginx
#測試

cd /usr/local/nginx/html/

touch index.php

vi /usr/local/nginx/html/index.php

復制代碼 代碼如下:

<?php

phpinfo();

?>

#discuz偽靜態

復制代碼 代碼如下:

rewrite ^([^\.]*)/topic-(.+)\.html$ $1/portal.php?mod=topic&topic=$2 last;

rewrite ^([^\.]*)/article-([0-9]+)-([0-9]+)\.html$ $1/portal.php?mod=view&aid=$2&page=$3 last;

rewrite ^([^\.]*)/forum-(\w+)-([0-9]+)\.html$ $1/forum.php?mod=forumdisplay&fid=$2&page=$3 last;

rewrite ^([^\.]*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=viewthread&tid=$2&extra=page%3d$4&page=$3 last;

rewrite ^([^\.]*)/group-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=group&fid=$2&page=$3 last;

rewrite ^([^\.]*)/space-(username|uid)-(.+)\.html$ $1/home.php?mod=space&$2=$3 last;

rewrite ^([^\.]*)/blog-([0-9]+)-([0-9]+)\.html$ $1/home.php?mod=space&uid=$2&do=blog&id=$3 last;

rewrite ^([^\.]*)/(fid|tid)-([0-9]+)\.html$ $1/index.php?action=$2&value=$3 last;

if (!-e $request_filename) {

return 404;

}

感謝各位的閱讀,以上就是“centos環境下lnmp怎么安裝配置”的內容了,經過本文的學習后,相信大家對centos環境下lnmp怎么安裝配置這一問題有了更深刻的體會,具體使用情況還需要大家實踐驗證。這里是億速云,小編將為大家推送更多相關知識點的文章,歡迎關注!

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

军事| 景谷| 黄山市| 黄冈市| 宝兴县| 黄大仙区| 耿马| 旺苍县| 丹寨县| 民县| 连城县| 铁岭市| 肃宁县| 玉林市| 延寿县| 嘉义市| 宁都县| 天柱县| 奈曼旗| 拉萨市| 鄂托克前旗| 密山市| 鹤壁市| 南江县| 岳普湖县| 公安县| 林周县| 香格里拉县| 兴化市| 吴川市| 博罗县| 平谷区| 阿勒泰市| 奇台县| 武胜县| 平远县| 淮阳县| 永清县| 柳河县| 介休市| 苏尼特右旗|