Follow-up configuration in "Nginx" LNMP Environment

Source: Internet
Author: User
Tags php tutorial
This article is a little bit of rain original, declined reprint

Objective

After the basic configuration, we can run the PHP environment directly on Nginx, then the next step is to do some of the following operations

Configuring the NIC

Since the current way of surfing from the assigned fixed IP to automatic allocation, you need to re-modify the NIC configuration

To view the virtual machine configuration, the virtual machine is using this on the Mac



Then modify the NIC configuration file to the corresponding MAC address and DHCP

[Root@localhost ~]# vi/etc/sysconfig/network-scripts/ifcfg-eth0device=eth1hwaddr=00:1c:42:29:8e:5btype=ethernet# uuid=6bfb6ea6-4db0-483c-8964-593fea939a82onboot=yes#nm_controlled=yesbootproto=dhcpipv6int=yesipv6_autoconf= Yes

Restart Network service, view IP

[Root@localhost ~]# Service network Restart is shutting down the interface eth0: [OK] close the loopback interface: [OK] Popup loopback interface: [OK] Popup interface eth0: Is deciding the IP information of eth1 ...                                                           Complete. Determine [Root@localhost ~]# ifconfigeth1 Link encap:ethernet HWaddr 00:1c:42:29:8e:5b inet addr:192.168.199.143 Bc ast:192.168.199.255 mask:255.255.255.0 inet6 addr:fe80::21c:42ff:fe29:8e5b/64 scope:link up BROADCAST          RUNNING multicast mtu:1500 metric:1 RX packets:355362 errors:0 dropped:0 overruns:0 frame:0 TX packets:75013 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:81823948  (78.0 MiB) TX bytes:11663119 (11.1 MiB) lo Link encap:local Loopback inet addr:127.0.0.1 mask:255.0.0.0 inet     6 Addr::: 1/128 scope:host up LOOPBACK RUNNING mtu:16436 metric:1     RX packets:578 errors:0 dropped:0 overruns:0 frame:0          TX packets:578 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:629817 (615.0 KiB) TX bytes:629817 (615.0 KiB)

This IP will then be used for SSH operation.

Installing PHP Extensions

The following first need to install the PHP extension section, you can refer to their previous installation Yar article, but this time do not look at their previous articles, after all, now using CentOS

PHP official website

http://php.net/manual/zh/book.yar.php
We install according to the recommended method of the official website
Http://pecl.php.net/package/yar

Msgpack

Installing Php-devel

[Root@localhost ~]# Yum Install Php-devel

Installing Msgpack

[root@localhost ~]# yum install gcc cc[root@localhost ~]# pecl channel-update pecl.php.net[root@localhost ~]# pecl Install Channel://pecl.php.net/msgpack-0.5.5build process completed successfullyinstalling '/usr/lib64/php/modules/ Msgpack.so ' Installing '/usr/include/php/ext/msgpack/php_msgpack.h ' install ok:channel://pecl.php.net/ Msgpack-0.5.5configuration option "Php_ini" is not set to php.ini locationyou should add "extension=msgpack.so" to PHP.ini

Modify PHP.ini

[Root@localhost ~]# Vim/etc/php.ini #写入扩展so [root@localhost ~]# service php-fpm Restart stop php-fpm:                                             [OK] starting PHP-FPM:                                         [OK]

Yar

[root@localhost ~]# pecl Install yarconfigure:error:Please Reinstall the Libcurl distribution-easy.h should 
 is in 
  
   
  /include/curl/[root@localhost ~]# yum install libcurl[root@localhost ~]# yum install wget
 
  

Re2c

[Root@localhost ~]# wget http://sourceforge.net/projects/re2c/files/re2c/0.13.5/re2c-0.13.5.tar.gz/download[ Root@localhost ~]# tar zxf download[root@localhost ~]# cd re2c-0.13.5[root@localhost re2c-0.13.5]# yum install Bison[root @localhost re2c-0.13.5]# yum install gcc gcc-c++ gcc-g77[root@localhost re2c-0.13.5]# make && make install

Re-install Curl

[Root@localhost ~]# yum  install Curl-devel

Installation Complete

[root@localhost ~]# pecl Install yarbuild process completed successfullyinstalling '/usr/lib64/php/modules/yar.so ' Install ok:channel://pecl.php.net/yar-1.2.4configuration option "Php_ini" is not set to php.ini locationyou should add "E Xtension=yar.so "to PHP.ini

Ini

[root@localhost ~]# service php-fpm Restart stop php-fpm:                                             [OK] starting php-fpm:[28-dec-2014 21:27:16] notice:php message:p HP Warning:  PHP startup:unable to load Dynamic Library '/usr/lib64/php/modules/yar.so '-/usr/lib64/php/modules/yar . so:undefined Symbol:php_json_encode in Unknown on line 0                                                           [OK]
This problem has been encountered before, meaning that the JSON needs to be loaded before loading Yar, but JSON is not loaded at this time and continues to modify PHP.ini

[root@localhost ~]# service php-fpm Restart stop php-fpm:                                             [OK] starting php-fpm:[28-dec-2014 21:29:40] notice:php message:p HP Warning:  Module ' json ' already loaded in Unknown on line 0                                                           [OK]

This means that the JSON has already been loaded and does not need to be loaded, so we remove the second loaded part

[Root@localhost php.d]# Vi/etc/php.d/json.ini; Enable JSON extension module;extension=json.so

Restart PHP-FPM

[root@localhost php.d]# service php-fpm Restart stop php-fpm:                                             [OK] starting php-fpm:                                         [OK]

Complete


Postscript

Nginx under the PHP configuration is done, then the detailed configuration of Nginx.

Yar does not support Mac, good Mulberry heart.

Cheer Up ~


The above describes the "Nginx" LNMP Environment of the following configuration, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.