1. 程式人生 > >lnmp配置 php7+mysql5.7

lnmp配置 php7+mysql5.7

作者:初生不惑

尊重原創特此標明作者

1. Nginx安裝配置

如果需要一些特殊的功能,在包和埠不可用的情況下,也可以從原始碼編譯來安裝nginx。雖然原始碼編譯安裝更靈活,但這種方法對於初學者來說可能很複雜(建議初學者自己使用原始碼編譯安裝來安裝nginx)。有關更多資訊,請參閱從源構建nginx

在本文中,主要介紹從原始碼安裝nginx,這篇教程是基於CentOS7 64bit系統來安裝的,非Centos系統不適用。現在我們就開始吧!

1.1 安裝前工作

首先更新系統軟體源,使用以下命令更新系統 -

[[email protected] ~]# yum update
Shell

有關兩個命令的一點解釋:
yum -y update

 - 升級所有包,改變軟體設定和系統設定,系統版本核心都升級
yum -y upgrade - 升級所有包,不改變軟體設定和系統設定,系統版本升級,核心不改變

依賴包安裝

[[email protected] src]# yum -y install gcc gcc-c++ autoconf automake libtool make cmake
[[email protected] src]# yum -y install zlib zlib-devel openssl openssl-devel pcre-devel
Shell

1.2. 下載Nginx安裝原始檔

原始碼下載,可官網下載地址:

http://nginx.org/en/download.html 下載並上傳到伺服器(這裡選擇最新穩定版本:nginx-1.10.3),如下圖所示 -

或直接在服務上執行以下命令下載 -

[[email protected] ~]# cd /usr/local/src
[[email protected] src]# wget -c http://nginx.org/download/nginx-1.10.3.tar.gz
Shell

解壓上面下載的檔案 -

[[email protected] src]# tar zxvf nginx-1.10.3.tar.gz
Shell

在編譯之前還要做一些前期的準備工作,如:依懶包安裝,Nginx使用者和使用者組等。

1.3. 新建nginx使用者及使用者組

使用 root 使用者身份登入系統,執行以下命令建立新的使用者。

[[email protected] src]# groupadd nginx
[[email protected] src]# useradd -g nginx -M nginx
Shell

useradd命令的-M引數用於不為nginx建立home目錄
修改/etc/passwd,使得nginx使用者無法bash登陸(nginx使用者後面由/bin/bash改為/sbin/nologin),

[[email protected] src]# vi /etc/passwd
Shell

然後找到有 nginx 那一行,把它修改為(後面由/bin/bash改為/sbin/nologin):

nginx:x:1002:1003::/home/nginx:/sbin/nologin

1.4. 編譯配置、編譯、安裝

下面我們進入解壓的nginx原始碼目錄:/usr/local/src/ 執行以下命令 -

[[email protected] ~]# cd /usr/local/src/nginx*
[[email protected] nginx-1.10.3]# pwd
/usr/local/src/nginx-1.10.3
[[email protected] nginx-1.10.3]#
[[email protected] nginx-1.10.3]# ./configure --prefix=/usr/local/nginx \
--pid-path=/usr/local/nginx/run/nginx.pid \
--with-http_ssl_module \
--user=nginx \
 --group=nginx \
--with-pcre \
--without-mail_pop3_module \
--without-mail_imap_module \
--without-mail_smtp_module

注意:上面的反斜槓\ 表示換行繼續。

--prefix=/usr/local/nginx 指定安裝到 /usr/local/nginx 目錄下。

上面配置完成後,接下來執行編譯 -

[[email protected] nginx-1.10.3]# make
[[email protected] nginx-1.10.3]# make install
... ...
cp conf/nginx.conf '/usr/local/nginx/conf/nginx.conf.default'
test -d '/usr/local/nginx/run' \
        || mkdir -p '/usr/local/nginx/run'
test -d '/usr/local/nginx/logs' \
        || mkdir -p '/usr/local/nginx/logs'
test -d '/usr/local/nginx/html' \
        || cp -R html '/usr/local/nginx'
test -d '/usr/local/nginx/logs' \
        || mkdir -p '/usr/local/nginx/logs'
make[1]: Leaving directory `/usr/local/src/nginx-1.10.3'
[[email protected] nginx-1.10.3]#
Shell

上面編譯時間跟你的電腦配置相關,所以可能需要一些等待時間。

檢視安裝後的程式版本:

[[email protected] nginx-1.10.3]# /usr/local/nginx/sbin/nginx -v
nginx version: nginx/1.10.3
Shell

修改Nginx預設埠(可選):

[[email protected] nginx-1.10.3]# vi /usr/local/nginx/conf/nginx.conf

找到 -

... ...
    #gzip  on;

    server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;
... ...
Shell

把上面的 80 修改為你想要的埠,如:8080 。
修改配置後驗證配置是否合法:

[[email protected] nginx-1.10.3]# /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
Shell

啟動Nginx程式、檢視程序 -

[[email protected] nginx-1.10.3]# /usr/local/nginx/sbin/nginx
[[email protected] nginx-1.10.3]# ps -ef | grep nginx
root      29151      1  0 22:01 ?        00:00:00 nginx: master process /usr/local/nginx/sbin/nginx
nginx     29152  29151  0 22:01 ?        00:00:00 nginx: worker process
root      29154   2302  0 22:01 pts/0    00:00:00 grep --color=auto nginx
[[email protected] nginx-1.10.3]#
Shell

nginx停止、重啟
未新增nginx服務前對nginx的管理只能通過一下方式管理:

#  nginx 管理的幾種方式 -
# 啟動Nginx 
/usr/local/nginx/sbin/nginx 
# 從容停止Nginx:
kill -QUIT 主程序號 # 如上一步中的 ps 命令輸出的 29151,就是 Nginx的主程序號
# 快速停止Nginx:
kill -TERM 主程序號
# 強制停止Nginx:
pkill -9 nginx
# 平滑重啟nginx
/usr/nginx/sbin/nginx -s reload

現在我們來看看安裝的Nginx的執行結果,可以簡單地使用curl命令訪問localhost測試,結果如下 -

[[email protected] nginx-1.10.3]# curl localhost
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
    body {
        width: 35em;
        margin: 0 auto;
        font-family: Tahoma, Verdana, Arial, sans-serif;
    }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>

<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>

<p><em>Thank you for using nginx.</em></p>
</body>
</html>
[[email protected] nginx-1.10.3]#

或者也可以開啟瀏覽訪問目標伺服器的IP,在本示例中,伺服器的IP地址是:192.168.0.195,所以開啟瀏覽器訪問如下結果 -

提示: 如果沒有看到以上介面,在確保Nginx啟動的前提下,檢查SeLinux和防火牆是否已關閉。關閉防火牆命令:systemctl stop firewalld.service

2. PHP7安裝配置

2.1 原始碼下載

官網地址:php7下載

[[email protected] ~]# cd /usr/local/src
[[email protected] src]# wget -c http://cn2.php.net/distributions/php-7.1.3.tar.gz
Shell

解壓壓縮包:

[[email protected] src]# tar -xzvf php-7.*
[[email protected] src]# cd php-7*
Shell

2.2 安裝編譯所需依賴包

[[email protected] php-7.1.3]# yum -y install libxml2 libxml2-devel openssl openssl-devel curl-devel libjpeg-devel libpng-devel freetype-devel libmcrypt-devel
Shell

或者常見大部分依懶包安裝 -

[[email protected] php-7.1.3]# yum install -y wget gcc gcc-c++ autoconf libjpeg libjpeg-devel perl perl* perl-CPAN 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 png jpeg autoconf gcc cmake make gcc-c++ gcc ladp ldap* ncurses ncurses-devel zlib zlib-devel zlib-static pcre pcre-devel pcre-static openssl openssl-devel perl libtoolt openldap-devel libxml2-devel ntpdate cmake gd* gd2 ImageMagick-devel jpeg jpeg* pcre-dev* fontconfig libpng libxml2 zip unzip gzip
Shell

2.3 原始碼編譯、安裝

通過 ./configure –help 檢視支援的編譯配置引數,如下所示 -

[[email protected] php-7.1.3]# ./configure --help
`configure' configures this package to adapt to many kinds of systems.

Usage: ./configure [OPTION]... [VAR=VALUE]...

To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE.  See below for descriptions of some of the useful variables.

Defaults for the options are specified in brackets.

Configuration:
  -h, --helpdisplay this help and exit
      --help=short        display options specific to this package
      --help=recursive    display the short help of all the included packages
  -V, --versiondisplayversion information and exit
  -q, --quiet, --silent   do not print `checking ...' messages
      --cache-file=FILE   cache test results inFILE [disabled]
  -C, --config-cache      alias for `--cache-file=config.cache'
  -n, --no-create         do not create output files
      --srcdir=DIR        find the sources inDIR [configure dir or `..']

Installation directories:
  --prefix=PREFIX         install architecture-independent files in PREFIX
                          [/usr/local]
  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
                          [PREFIX]

By default, `make install' will install all the files in
`/usr/local/bin', `/usr/local/lib' etc.  You can specify
an installation prefix other than `/usr/local' using `--prefix',
for instance `--prefix=$HOME'.

For better control, use the options below.
Shell

PHP+Nginx組合的編譯配置命令 -

[[email protected] php-7.1.3]# ./configure --prefix=/usr/local/php7 \
--with-config-file-path=/usr/local/php7/etc \
--with-config-file-scan-dir=/usr/local/php7/etc/php.d \
--with-mcrypt=/usr/include \
--enable-mysqlnd \
--with-mysqli \
--with-pdo-mysql \
--enable-fpm \
--with-fpm-user=nginx \
--with-fpm-group=nginx \
--with-gd \
--with-iconv \
--with-zlib \
--enable-xml \
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization \
--enable-mbregex \
--enable-mbstring \
--enable-ftp \
--enable-gd-native-ttf \
--with-openssl \
--enable-pcntl \
--enable-sockets \
--with-xmlrpc \
--enable-zip \
--enable-soap \
--without-pear \
--with-gettext \
--enable-session \
--with-curl \
--with-jpeg-dir \
--with-freetype-dir \
--enable-opcache

# 執行完成後的結果:
Generating files
configure: creating ./config.status
creating main/internal_functions.c
creating main/internal_functions_cli.c
+--------------------------------------------------------------------+
| License:                                                           |
| This software is subject to the PHP License, available in this     |
| distribution in the file LICENSE.  By continuing this installation |
| process, you are bound by the terms of this license agreement.     |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point.                            |
+--------------------------------------------------------------------+

Thank you for using PHP.

config.status: creating php7.spec
config.status: creating main/build-defs.h
config.status: creating scripts/phpize
config.status: creating scripts/man1/phpize.1
config.status: creating scripts/php-config
config.status: creating scripts/man1/php-config.1
config.status: creating sapi/cli/php.1
config.status: creating sapi/fpm/php-fpm.conf
config.status: creating sapi/fpm/www.conf
config.status: creating sapi/fpm/init.d.php-fpm
config.status: creating sapi/fpm/php-fpm.service
config.status: creating sapi/fpm/php-fpm.8
config.status: creating sapi/fpm/status.html
config.status: creating sapi/cgi/php-cgi.1
config.status: creating ext/phar/phar.1
config.status: creating ext/phar/phar.phar.1
config.status: creating main/php_config.h
config.status: executing default commands
Shell

編譯 + 安裝,編譯原始碼, 如下所示 -


$ make
Generating phar.php
Generating phar.phar
PEAR package PHP_Archive not installed: generated phar will require PHP's phar extension be enabled.
directorytreeiterator.inc
pharcommand.inc
directorygraphiterator.inc
invertedregexiterator.inc
clicommand.inc
phar.inc

Build complete.
Don't forget to run 'make test'.

## 對編譯結果進行測試:
[[email protected] php-7.1.3]# make test
## 很遺憾,我這裡make test報錯了,已反饋php test資訊。

## 安裝程式至指定目錄:
[[email protected] php-7.1.3]# make install
Installing shared extensions:     /usr/local/php7/lib/php/extensions/no-debug-non-zts-20160303/
Installing PHP CLI binary:        /usr/local/php7/bin/
Installing PHP CLI man page:      /usr/local/php7/php/man/man1/
Installing PHP FPM binary:        /usr/local/php7/sbin/
Installing PHP FPM defconfig:     /usr/local/php7/etc/
Installing PHP FPM man page:      /usr/local/php7/php/man/man8/
Installing PHP FPM status page:   /usr/local/php7/php/php/fpm/
Installing phpdbg binary:         /usr/local/php7/bin/
Installing phpdbg man page:       /usr/local/php7/php/man/man1/
Installing PHP CGI binary:        /usr/local/php7/bin/
Installing PHP CGI man page:      /usr/local/php7/php/man/man1/
Installing build environment:     /usr/local/php7/lib/php/build/
Installing header files:          /usr/local/php7/include/php/
Installing helper programs:       /usr/local/php7/bin/
  program: phpize
  program: php-config
Installing man pages:             /usr/local/php7/php/man/man1/
  page: phpize.1
  page: php-config.1
/usr/local/src/php-7.1.3/build/shtool install -c ext/phar/phar.phar /usr/local/php7/bin
ln -s -f phar.phar /usr/local/php7/bin/phar
Installing PDO headers:           /usr/local/php7/include/php/ext/pdo/
[[email protected] php-7.1.3]#
Shell

檢視安裝成功後的版本資訊 -

[[email protected] local]# /usr/local/php7/bin/php -v
PHP 7.1.3 (cli) (built: Apr 13 2017 22:47:30) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
[[email protected] local]#
Shell

2.4. 修改配置

修改php配置,檢視php載入配置檔案路徑:

[[email protected] local]# /usr/local/php7/bin/php -i | grep php.ini
Configuration File (php.ini) Path => /usr/local/php7/etc
[[email protected] local]#
Shell

php-7.1.3原始碼目錄下:

[[email protected] local]# ll /usr/local/src/php-7.1.3/ | grep ini
-rw-rw-r--.  1 yiibai yiibai   71063 Mar 14 09:17 php.ini-development
-rw-rw-r--.  1 yiibai yiibai   71095 Mar 14 09:17 php.ini-production
[[email protected] local]#
Shell

複製PHP的配置檔案,使用以下命令 -

[[email protected] local]# cp /usr/local/src/php-7.1.3/php.ini-production /usr/local/php7/etc/php.ini
## 根據需要對`php.ini`配置進行配置修改,請自行參考官方文件配置 。
[[email protected] local]# /usr/local/php7/bin/php -i | grep php.ini
Configuration File (php.ini) Path => /usr/local/php7/etc
Loaded Configuration File => /usr/local/php7/etc/php.ini
[[email protected] local]#
Shell

2.5 啟用php-fpm服務

上面我們在編譯php7的時候,已經將fpm模組編譯了,那麼接下來,我們要啟用php-fpm。但是預設情況下它的配置檔案和服務都沒有啟用,所以要我們自己來配置,先重新命名並移動以下兩個檔案:

[[email protected] local]# cd /usr/local/php7/etc
[[email protected] etc]# cp php-fpm.conf.default php-fpm.conf
[[email protected] etc]# cp php-fpm.d/www.conf.default php-fpm.d/www.conf
Shell

php-fpm的具體配置這裡不做深入去詳解,因為在編譯之前./configure的時候,我們都已經確定了一些配置,比如執行fpm的使用者和使用者組之類的,所以預設配置應該不會存在路徑問題和許可權問題。

配置php-fpm的服務載入:
就像上面的nginx一樣,我們希望使用 service php-fpm start|stop|restart 這些操作來實現服務的重啟,但沒有像nginx那麼複雜,php編譯好之後,給我們提供了一個php-fpm的程式。這個檔案放在php編譯原始碼目錄中:

[[email protected] local]#  cd /usr/local/src/php-7.1.3/sapi/fpm/
## 或直接使用可執行檔案: /usr/local/php7/sbin/php-fpm
[[email protected] local]# ls
[[email protected] local]# cp init.d.php-fpm /etc/init.d/php-fpm
[[email protected] local]# chmod +x /etc/init.d/php-fpm
[[email protected] local]# chkconfig --add php-fpm
[[email protected] local]# chkconfig php-fpm on
Shell

通過上面這個操作,我們就可以使用 service php-fpm start 來啟用php-fpm了。用 ps -ef | grep php-fpm看看程序吧。

[[email protected] fpm]# ps -ef | grep php-fpm
root     108421      1  0 23:19 ?        00:00:00 php-fpm: master process (/usr/local/php7/etc/php-fpm.conf)
nginx    108422 108421  0 23:19 ?        00:00:00 php-fpm: pool www
nginx    108423 108421  0 23:19 ?        00:00:00 php-fpm: pool www
root     108507   2285  0 23:23 pts/0    00:00:00 grep --color=auto php-fpm
[[email protected] fpm]#
Shell

這樣,PHP環境就安裝完成了,接下來我們通過Nginx代理整合PHP7,來實現Nginx+PHP服務。

3. Nginx代理整合PHP7配置

通過上面的操作,nginxphp-fpm服務都已經正常執行起來了,但是php-fpm只是在127.0.0.1:9000上提供服務,外網是無法訪問的,而且也不可能直接通過php-fpm給外網提供服務,因此需要使用nginx去代理9000埠執行php
實際上這個過程只需要對nginx進行配置即可,php-fpm已經在後臺運行了,我們需要在nginx的配置檔案中增加代理的規則,即可讓使用者在訪問80埠,請求php的時候,交由後端的php-fpm去執行,並返回結果。現在編輯Nginx的配置檔案 -

[[email protected] local]# vi /usr/local/nginx/conf/nginx.conf
Shell

如果你大致瞭解過nginx的配置,應該能夠很快分辨出這個配置檔案裡面的結構,並且知道server塊代表一個虛擬主機,要增加虛擬主機就再增加一個server塊,而且這個conf檔案中也給出了例子。那麼怎麼代理php-fpm呢?找到:

#location ~ \.php$ {
#   root           html;
#  fastcgi_pass   127.0.0.1:9000;
#  fastcgi_index  index.php;
#  fastcgi_param  SCRIPT_FILENAME  /script$fastcgi_script_name;
#  include        fastcgi_params;
#}
Shell

把前面的#註釋符號去掉,把script改為$document_root最終如下:

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;
        }
Shell

這樣就可以了,重新載入nginx配置即可,使用以下命令 -

/usr/local/nginx/sbin/nginx -s reload
Shell

然後到/usr/local/nginx/html去寫一個php檔案:index.php進行測試,檔案:index.php的程式碼如下 -

<?php
    phpinfo();
?>
PHP

現在訪問目錄IP,應該能看到結果如下 -

提示:如果無法開啟,可能需要關閉防火牆,使用命令:systemctl stop firewalld

附完整的Nginx配置(

相關推薦

lnmp配置 php7+mysql5.7

作者:初生不惑尊重原創特此標明作者1. Nginx安裝配置如果需要一些特殊的功能,在包和埠不可用的情況下,也可以從原始碼編譯來安裝nginx。雖然原始碼編譯安裝更靈活,但這種方法對於初學者來說可能很複雜(建議初學者自己使用原始碼編譯安裝來安裝nginx)。有關更多資訊,請參閱

騰訊雲Centos7安裝lnmpphp7+mysql5.7+nginx1.14)全過程

安裝nginx 1、首先下載對應當前系統版本(Centos7)的nginx包(package) wget http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch

Windows10 下安裝配置IIS + MySQL5.7.19 + nginx1.12.1 + php7.1.7

fast ble 安裝 local 映射 int 網頁 ces internet 環境: VMWare Workstation Player12 Windows10 Pro x64 一、安裝系統 vmware 會采用 fast install 方式很快裝完,無

CentOS7下PHP7,MySQL5.7,Nginx1.10以及對應的redis,swoole擴充套件的安裝與配置

花了一點時間搞定,自己虛擬機器的環境,做點記錄 LNMP環境的安裝 中文:http://www.lnmp.cn/installing-php7-mysql57-nginx18-under-centos7.html 英文:https://www.digitaloc

CentOS 7 安裝 LNMP 環境(PHP7 + MySQL5.7 + Nginx1.10)過程筆記。

一、修改 yum 源 [[email protected] ~]# rpm -Uvh https://dl.Fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm [[email prot

CentOS 7 安裝 LNMP 環境(PHP7 + MySQL5.7 + Nginx1.10)

記錄下在CentOS 7 安裝 LNMP 環境(PHP7 + MySQL5.7 + Nginx1.10)過程筆記。 工具 VMware版本號 : 12.0.0 CentOS版本 : 7.0 一、修改 yum 源 二、安裝 Nginx、MySQL

LNMP環境搭建 mysql5.7.20+nginx1.13.7+php7.1.12

1.首先安裝依賴包[root@localhost ~]# yum -y install gcc [root@localhost ~]# yum -y install gcc++ [root@localhost ~]# yum -y install gcc-c++ [root@

centos7 Nginx1.14+php7+mysql5.7 以及 centos7 Apache2.4+PHP7+mysql 安裝 Linux 配置 composer 以及Python2.7升級到3.7

ack ria util oca 簡單 www. mbstring fig yum 1 centos7 Nginx1.14+php7.0+mysql5.7 (LNMP)安裝 nginx rpm -Uvh http://nginx.org/packages/centos

Windows7+IIS+PHP7+MySQL5.7環境搭建

站點 窗口 開始 -a 臨時 避免 自動 搭建 移動 IIS配置 本次搭建使用的系統是Windows7,Windows8,10與此類似。 開啟IIS 開始-->控制面板-->程序和功能,點擊左邊欄的開啟或關閉Windows功能,如圖: 選擇Internet信息

轉載:centos7 安裝php7+mysql5.7+nginx+redis

      、1.先修改yum源  https://webtatic.com rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm rpm

Centos6.8 PHP7+MYSQL5.7

1.安裝nginx 修改yum源 [plain]  view plain  copy vim /etc/yum.repos.d/nginx.repo  

搭建lnmp環境(mysql5.7-yum)

使用yum方式安裝mysql yum下載地址:https://dev.mysql.com/downloads/repo/yum/ 下載yum源 將下載好的yum源放在/usr/local/sr

linux下安裝php7+mysql5.7+nginx

一。安裝常用擴充套件庫 1 2 3 sudo yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng

LNMP架構--linux7.4+nginx1.13.9+mysql5.7.20+php7.1.10

雲計算;web服務器;數據庫;LNMP;一、 環境安裝包下載地址:http://nginx.org/en/download.htmlservice firewalld stopsystemctl disable firewalld將安裝包通過WinSCP傳到虛擬機二、 nginx安裝yum -y inst

LNMP, CentOS7.0+Nginx+Mysql5.7+PHP7環境安裝

character 服務器架構 -s ring web stc targe tis ... LNMP代表的就是:Linux系統下Nginx+MySQL+PHP這種網站服務器架構。這裏和家分享一下,如何在CentOS 7.0上搭建一個這樣的環境,其中軟件使用yum方式安裝。

Ubuntu 18.04.1 下快速搭建 LNMP環境(PHP7.2.5+MySql5.7+Nginx1.14.0)

在Linux環境下,搭建LNMP環境,大家以前或多或少都做過相關的操作,但是隨著軟體的更新,PHP,MySQL不斷的升級,以往很多比較老的教程,都已經無法完成這個搭建環境的任務了,今天偶然有興趣在最新的Ubuntu18.04上搭建LNMP環境,本來感覺挺容易的,但是在實際操作

centos7.2+php7.2+nginx1.12.0+mysql5.7配置

一. 原始碼安裝php7.2 選擇需要的php版本 從 php官網: http://cn2.php.net/downloads.php 選擇需要的php版本,選擇.tar.gz 的下載包,點選進入,選擇中國的本地語言包,複製這個下載地址 最後得到的

centos7進行yum安裝lnmp(linux+nginx+php7.1+mysql5.7

yum的安裝      1.yum update 下載原始碼時前面需要加上 rpm -ivh  yum localinstall http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0

Ubuntu16.04 LNMP (PHP7.0+Mysql5.7+Nginx1.10)

3.configer: 然後改配置檔案,php的配置檔案不用改就能用,nginx的配置檔案不行,預設情況下是不支援php CGI的,所以得改一下: vim /etc/nginx/sites-available/default 找到 # #location ~ \.php$ { # include snipp

lnmp搭建(Nginx1.12.1;mysql5.7.20;php7.2.0)

安裝依賴包: #yum install gcc bison bison-devel zlib-devel libmcrypt-devel mcrypt mhash-devel openssl-devel libxml2-devel libcurl-devel