[Nginx] subsequent configuration in LNMP environment

Source: Internet
Author: User
: This article mainly introduces the subsequent configuration in the [Nginx] LNMP environment. if you are interested in the PHP Tutorial, refer to it. This article is original and declined to be reproduced

Preface

After completing the basic configuration, we can directly run the php environment on nginx. The next step is to perform subsequent operations.

Configure the NIC

Since the current Internet access mode has changed from allocating a fixed ip address to automatically allocating, you need to re-modify the Nic configuration

Check the virtual machine configuration. the virtual machine uses



Then modify the Nic configuration file to the corresponding mac address and dhcp address.

[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 the network service and view the ip address

[Root @ localhost ~] # Service network restart is shutting down the interface eth0: [OK] closing the loopback interface: [OK] the loopback interface is displayed: [OK] the pop-up interface eth0: the IP address of eth1 is being determined... complete. [OK] [root @ localhost ~] # Ifconfigeth1 Link encap: Ethernet HWaddr 00: 1C: 42: 29: 8E: 5B inet addr: 192.168.199.143 Bcast: 192.168.199.255 Mask: 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 inet6 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)

Then, the IP address will be used for ssh operations.

Install PHP extension

The following section describes how to install PHP Extensions. you can refer to your previous articles on yar installation. However, I will not read my previous articles this time. after all, I am using centos

PHP official website

http://php.net/manual/zh/book.yar.php
We recommend installation on the official website.
http://pecl.php.net/package/yar

Msgpack

Install php-devel

[root@localhost ~]# yum install php-devel

Install 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 # write extension 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 be 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

Reload 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 "extension=yar.so" to php.ini

Php. ini

[Root @ localhost ~] # Service php-fpm restart stop php-fpm: [OK] starting php-fpm: [28-Dec-2014 21:27:16] NOTICE: PHP message: PHP 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, that is to say, json needs to be loaded before yar is loaded, but json is not loaded at this time, and php. ini is modified.

[Root @ localhost ~] # Service php-fpm restart stop php-fpm: [OK] starting php-fpm: [28-Dec-2014 21:29:40] NOTICE: PHP message: PHP Warning: module 'json' already loaded in Unknown on line 0 [OK]

This indicates that the json file has been loaded and does not need to be loaded.

[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

The php configuration under Nginx is complete, and the following is the detailed configuration of Nginx.

Yar does not support mac.

Come on ~


The above describes the subsequent configuration in the [Nginx] LNMP environment, including some content. I hope my friends who are interested in the PHP Tutorial will be 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.