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

溫馨提示×

溫馨提示×

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

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

Lamp(Fpm-Php)基本配置

發布時間:2020-07-09 15:34:21 來源:網絡 閱讀:646 作者:xiaobing002 欄目:web開發

LAMP簡介

LAMP(Linux- Apache-MySQL-PHP)網站架構是目前國際流行的Web框架,該框架包括:Linux操作系統,Apache網絡服務器,MySQL數據庫,Perl、PHP或者Python編程語言,所有組成產品均是開源軟件,是國際上成熟的架構框架,很多流行的商業應用都是采取這個架構。LAMP具有通用、跨平臺、高性能、低價格的 優勢,因此LAMP無論是性能、質量還是價格都是企業搭建網站的首選平臺。

二 Mysql 配置

1首先下載mysql-5.5.33包組(mariadb-5.5.36-linux-x86_64.tar.gz),然后解壓mariadb-5.5.36-linux-x86_64.tar.gz/usr/local

[root@localhost ~]# tar xfmariadb-5.5.36-linux-x86_64.tar.gz -C /usr/local

2 準備數據存放的文件系統

  a 新建一個sda3

       [root@localhost~]# fdisk /dev/sda

       Command (m for help): n

Commandaction

   e  extended

   p  primary partition (1-4)

p    

Partitionnumber (1-4): 3     

Firstcylinder (7859-13054, default 7859):

Usingdefault value 7859

Lastcylinder, +cylinders or +size{K,M,G} (7859-13054, default 13054): +20G      

 

Command(m for help): t

Partitionnumber (1-4): 3

Hex code(type L to list codes): 8e    (文件系統為LVM

Changedsystem type of partition 3 to 8e (Linux LVM)

 

Command (m for help): w

 

b讀入磁盤中

   [root@localhost ~]# kpartx -af /dev/sda

device-mapper: reload ioctl on sda1failed: Invalid argument

create/reload failed on sda1

device-mapper: reload ioctl on sda2failed: Invalid argument

create/reload failed on sda2

device-mapper: reload ioctl on sda3failed: Invalid argument

create/reload failed on sda3

 

  [root@localhost ~]# partx -a /dev/sda

BLKPG: Device or resource busy

error adding partition 1

BLKPG: Device or resource busy

error adding partition 2

BLKPG: Device or resource busy

error adding partition 3         (表示已經讀入到磁盤中)

 

c 新建邏輯卷,并將其掛載至特定目錄,此處目錄設置為/mydata

   [root@localhost ~]# pvcreate /dev/sda3

 Physical volume "/dev/sda3" successfully created

[root@localhost ~]# vgcreate myvg/dev/sda3

 Volume group "myvg" successfully created

[root@localhost ~]# lvcreate -L 10G -nmydata myvg

 Logical volume "mydata" created

[root@localhost ~]# mke2fs -t ext4 -LMYDATA -b 4096 -m 3 /dev/myvg/mydata

   

     并且能開機掛載,編輯fastab文件

     /dev/mapper/vg0-root    /                       ext4    defaults        1 1

UUID=90ebd4cf-95c1-4338-b0dd-19b2b1cb943d/boot                   ext4    defaults        1 2

/dev/mapper/vg0-usr     /usr                    ext4    defaults        1 2

/dev/mapper/vg0-var     /var                    ext4    defaults        1 2

/dev/mapper/vg0-swap    swap                    swap    defaults        0 0

tmpfs                   /dev/shm                tmpfs   defaults        0 0

devpts                  /dev/pts                devpts  gid=5,mode=620  0 0

sysfs                   /sys                    sysfs   defaults        0 0

proc                    /proc                   proc    defaults        0 0

LABEL=MYDATA            /mydata                 ext4    defaults        0 0 

(開機掛載)

   

d  新建用戶以安全方式運行進程,并創建鏈接

    [root@localhost ~]# groupadd -r mysql

[root@localhost ~]# useradd-g mysql -r mysql

[root@localhost ~]# idmysql

uid=496(mysql)gid=493(mysql) groups=493(mysql)

[root@localhost ~]#chown  -R mysql.mysql /mydata/data/

[root@localhost ~]# ll -a/mydata/data/

total 8

drwxr-xr-x 2 mysql mysql4096 Aug 11 20:15 .

先進入/usr/local目錄下

[root@localhost local]# ln-sv mariadb-5.5.36-linux-x86_64 mysql

 

lrwxrwxrwx  1 root root   27 Aug 11 20:18mysql -> mariadb-5.5.36-linux-x86_64

 

e mysql提供主配置文件

cd/usr/local/mysql/

 

mkdir /etc/mysql創建一個目錄,因為在/etc下有個my.cnf

cpsupport-files/my-large.cnf /etc/mysql/my.cnf

vim/etc/mysql/my.cnf

 

     port            = 3306

socket          =/tmp/mysql.sock

skip-external-locking

key_buffer_size = 256M

max_allowed_packet = 1M

table_open_cache = 256

sort_buffer_size = 1M

read_buffer_size = 1M

read_rnd_buffer_size = 4M

myisam_sort_buffer_size = 64M

thread_cache_size = 8

query_cache_size= 16M

# Try number of CPU's*2 for thread_concurrency

thread_concurrency = 8

datadir = /mydata/data    (指定mysql數據文件的存放位置)

 

開始初始化

[root@localhostmysql]# scripts/mysql_install_db --user=mysql --datadir=/mydata/data/

(此處必須在 mysql 目錄下,要在scripts初始化,會報錯)

 

f  mysql提供sysv服務腳本

   [root@localhostmysql]# cp support-files/mysql.server /etc/rc.d/init.d/mysqld

  

然后添加到服務列表中

   [root@localhost mysql]# chkconfig --addmysqld

  [root@localhost mysql]# chkconfig --list mysqld

mysqld            0:off1:off2:on3:on4:on5:on6:off

 

啟動服務

root@localhost mysql]# service mysqld start

Starting MySQL...                                         [  OK  ]

[root@localhost mysql]# ss -tnl

State     Recv-Q Send-Q                Local Address:Port                  Peer Address:Port

LISTEN    0      128                                *:52971                             *:*    

LISTEN    0      128                               :::50732                            :::*    

LISTEN    0      128                               :::111                              :::*    

LISTEN    0      128                                *:111                               *:*    

LISTEN    0      128                               :::22                               :::*    

LISTEN    0      128                                *:22                                *:*    

LISTEN    0      128                        127.0.0.1:631                               *:*    

LISTEN    0      128                              ::1:631                              :::*    

LISTEN    0      100                              ::1:25                               :::*    

LISTEN    0      100                        127.0.0.1:25                                *:*    

LISTEN    0      128                        127.0.0.1:6010                              *:*    

LISTEN    0      128                              ::1:6010                             :::*    

LISTEN     0     50                                *:3306                             *:*   3306端口已啟動)

 

設置權限

   [root@localhostmysql]#chmod +x /etc/rc.d/init.d/mysqld

 

 

編輯環境變量

[root@localhost~]# vim /etc/profile.d/mysql.sh

exportPATH=/usr/local/mysql/bin:$PATH

 

h導出頭文件和庫文件

   ln -sv /usr/local/mysql/include  /usr/include/mysql

  

[root@localhost~]# vim /etc/ld.so.conf.d/mysql.conf (新建)

                   /usr/local/mysql/lib

   讓系統重新載入

[root@localhost ~]#ldconfig -v | grep mysql

/usr/local/mysql/lib:

                   libmysqld.so.18 -> libmysqld.so.18

                   libmysqlclient.so.18 ->libmysqlclient_r.so.18.0.0

/usr/lib64/mysql:

                 libmysqlclient.so.16 -> libmysqlclient.so.16.0.0

                 libmysqlclient_r.so.16 -> libmysqlclient_r.so.16.0.0


三 Apache2.4.9 編譯安裝

首先檢測pcre-devel  "Development tools" "Server Platform Development"  這個三個包組裝了沒

yum -y install pcre-devel

yum -y groupinstall "Development tools"

yum -y groupinstall "Server Platform Development


然后編譯安裝apr

# tar xf apr-1.5.0.tar.bz2
# cd apr-1.5.0
# ./configure --prefix=/usr/local/apr
# make && make install

在編譯apr-util

# tar xf apr-util-1.5.3.tar.bz2
# cd apr-util-1.5.3
# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
# make && make install

編譯安裝httpd2.4.9

# tar xf httpd-2.4.9.tar.bz2
# cd httpd-2.4.9
# ./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd24 --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-modules=most --enable-mpms-shared=all --with-mpm=event
# make && make install

(為了不和系統的httpd沖突,我們指定其安裝路徑為/usr/local/apache,配置文件裝到/etc/httd24中,同時一會兒的服務也要改為httpd24 )


修改httpd的主配置文件,設置其Pid文件的路徑

[root@web httpd24]# vim /etc/httpd24/httpd.conf 

#添加下面一行

PidFile "/var/run/httpd.pid"


提供SysV服務腳本/etc/rc.d/init.d/httpd,內容


#!/bin/bash
#
# httpd        Startup script for the Apache HTTP Server
#
# chkconfig: - 85 15
# description: Apache is a World Wide Web server.  It is used to serve \
#        HTML files and CGI.
# processname: httpd
# config: /etc/httpd/conf/httpd.conf
# config: /etc/sysconfig/httpd
# pidfile: /var/run/httpd.pid

# Source function library.
. /etc/rc.d/init.d/functions

if [ -f /etc/sysconfig/httpd ]; then
        . /etc/sysconfig/httpd
fi

# Start httpd in the C locale by default.
HTTPD_LANG=${HTTPD_LANG-"C"}

# This will prevent initlog from swallowing up a pass-phrase prompt if
# mod_ssl needs a pass-phrase from the user.
INITLOG_ARGS=""

# Set HTTPD=/usr/sbin/httpd.worker in /etc/sysconfig/httpd to use a server
# with the thread-based "worker" MPM; BE WARNED that some modules may not
# work correctly with a thread-based MPM; notably PHP will refuse to start.

# Path to the apachectl script, server binary, and short-form for messages.
apachectl=/usr/local/apache/bin/apachectl
httpd=${HTTPD-/usr/local/apache/bin/httpd}
prog=httpd
pidfile=${PIDFILE-/var/run/httpd.pid}
lockfile=${LOCKFILE-/var/lock/subsys/httpd}
RETVAL=0

start() {
        echo -n $"Starting $prog: "
        LANG=$HTTPD_LANG daemon --pidfile=${pidfile} $httpd $OPTIONS
        RETVAL=$?
        echo
        [ $RETVAL = 0 ] && touch ${lockfile}
        return $RETVAL
}

stop() {
  echo -n $"Stopping $prog: "
  killproc -p ${pidfile} -d 10 $httpd
  RETVAL=$?
  echo
  [ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
}
reload() {
    echo -n $"Reloading $prog: "
    if ! LANG=$HTTPD_LANG $httpd $OPTIONS -t >&/dev/null; then
        RETVAL=$?
        echo $"not reloading due to configuration syntax error"
        failure $"not reloading $httpd due to configuration syntax error"
    else
        killproc -p ${pidfile} $httpd -HUP
        RETVAL=$?
    fi
    echo
}

# See how we were called.
case "$1" in
  start)
  start
  ;;
  stop)
  stop
  ;;
  status)
        status -p ${pidfile} $httpd
  RETVAL=$?
  ;;
  restart)
  stop
  start
  ;;
  condrestart)
  if [ -f ${pidfile} ] ; then
    stop
    start
  fi
  ;;
  reload)
        reload
  ;;
  graceful|help|configtest|fullstatus)
  $apachectl $@
  RETVAL=$?
  ;;
  *)
  echo $"Usage: $prog {start|stop|restart|condrestart|reload|status|fullstatus|graceful|help|configtest}"
  exit 1
esac

exit $RETVAL

而后為此腳本賦予執行權限:
# chmod +x /etc/rc.d/init.d/httpd

加入服務列表:
# chkconfig --add httpd


Lamp(Fpm-Php)基本配置


3 編譯安裝php-5.4.26

先解決依賴關系,不過首先要解決yum源問題,

# yum -y groupinstall "X Software Development" 


編譯安裝php-5.4.26

# tar xf php-5.4.26.tar.bz2

# cd php-5.4.26

./configure --prefix=/usr/local/php5 --with-mysql=--with-mysql=mysqlnd --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-mysqli=--with-mysql=mysqlnd --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --enable-mbstring --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml  --enable-sockets --enable-fpm --with-mcrypt  --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --with-bz2

(因為本機是沒有裝mysql,所以文中紅色部分是本機沒裝mysql的編譯)

# make

# make install



然后為

為php提供配置文件:

# cp php.ini-production /etc/php.ini



配置php-fpm

 

為php-fpm提供SysV init腳本,并將其添加至服務列表:

# cp sapi/fpm/init.d.php-fpm  /etc/rc.d/init.d/php-fpm

# chmod +x /etc/rc.d/init.d/php-fpm

# chkconfig --add php-fpm

# chkconfig php-fpm on


為php-fpm提供配置文件:

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

# vim /usr/local/php/etc/php-fpm.conf

pm.max_children = 50

pm.start_servers = 5

pm.min_spare_servers = 2

pm.max_spare_servers = 8

pid = /usr/local/php/var/run/php-fpm.pid 

然后重啟服務

# service php-fpm start

查看端口

# netstat -tnlp | grep php-fpm

tcp        0      0 127.0.0.1:9000              0.0.0.0:*                   LISTEN      689/php-fpm 


配置http-2.4.9

在Apache httpd 2.4以后已經專門有一個模塊針對FastCGI的實現,此模塊為mod_proxy_fcgi.so,它其實是作為mod_proxy.so模塊的 擴充,因此,這兩個模塊都要加載

       LoadModule proxy_module modules/mod_proxy.so

       LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so


配置虛擬主機支持使用fcgi

     1)要使用虛擬主機,首先要關閉中心主機,再開啟虛擬主機的模塊兒,也是在/etc/httpd24/httpd.conf中

     在相應的虛擬主機中添加類似如下兩行。

ProxyRequests Off  關閉正向代理

ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/PATH/TO/DOCUMENT_ROOT/$1


然后編輯apache配置文件httpd.conf,讓apache能識別php格式的頁面,并支持php格式的主頁

 

 # vim /etc/httpd/httpd.conf

 1、添加如下二行

   AddType application/x-httpd-php  .php

   AddType application/x-httpd-php-source  .phps


 2、定位至DirectoryIndex index.html 

   修改為:

    DirectoryIndex  index.php  index.html


然后測試

Lamp(Fpm-Php)基本配置
















向AI問一下細節

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

AI

花垣县| 开江县| 永善县| 北票市| 同江市| 林州市| 淮北市| 深泽县| 定日县| 荣昌县| 福安市| 静乐县| 江永县| 海门市| 华容县| 平利县| 长岛县| 江油市| 阜平县| 五莲县| 宜阳县| 老河口市| 松桃| 甘孜| 柏乡县| 东安县| 奉节县| 仁寿县| 铜鼓县| 西华县| 余姚市| 木里| 宜都市| 日照市| 齐齐哈尔市| 鄱阳县| 福建省| 鄂温| 资溪县| 昭苏县| 汉寿县|