Stellen Sie LNMP bereit

nginx mit apache verglichen, nginx verwendet das epool-Modell, und Leistung ist execllent als Apache.

Dieser Artikel stellt LNMP vor (Linux+Nginx+MySQL+PHP) Bereitstellung in CentOS6.3 x86-64

Schritte:

1. install libxml2

./konfigurieren –prefix=/usr/local/libxml2

Make && make install

2. install libmcrypt

./konfigurieren –prefix=/usr/local/libmcrypt

machen && make install

5. install libiconv-1.14

./konfigurieren –prefix=/usr/local/libiconv

machen && make install

6. install zlib-1.2.8

./konfigurieren –Präfix = / usr / local / zlib

machen && make install

7. install libpng-1.4.3

./konfigurieren –prefix=/usr/local/libpng

machen && make install

8. install jpegsrc.v8b

./konfigurieren \

prefix=/usr/local/jpeg8/ \

–aktivieren-geteilt \

enable-static

machen && make install

9. install freetype-2.3.9

./konfigurieren –prefix=/usr/local/freetype

machen && make install

10. install autoconf-2.69

./konfigurieren

machen && make install

11. install GD library

./konfigurieren \

prefix=/usr/local/gd2/ \

with-zlib=/usr/local/zlib/ \

with-jpeg=/usr/local/jpeg8/ \

with-png=/usr/local/libpng/ \

machen && make install

12. 安装mysql

./konfigurieren \

prefix=/usr/local/mysql \

with-charset=gbk \

with-unix-socket=/tmp/mysql.sock \

with-extral-charsets=all \

machen && make install

 

set permission and owner of mysql installation dictionary.

chmod +w /usr/local/mysql

chown -R mysql:mysql /usr/local/mysql

 

deal with my.cnf

cd support-files/

cp my-default.cnf /etc/my.cnf

vi /etc/my.cnf

 

deal with startup script of mysql

cp mysql.server /etc/init.d/mysqld

chmod +x mysqld

mysql initialization

/usr/local/mysql/scripts/mysql_install_db \

–defaults-file=/etc/my.cnf \

basedir=/usr/local/mysql \

datadir=/usr/local/mysql/data/ \

ausführen “service mysqld startand you can check whether 3306 port is openning.

13. install nginx-1.5.2

./konfigurieren –Präfix = / usr / local / nginx \

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

–with-http_ssl_module \

–with-http_mp4_module \

–with-http_stub_status_module \

–http-fastcgi-temp-path=/var/tmp/nginx/fcgi \

machen && make install

startup nginx

service nginx start

Input http://192.168.17.55 in url bar. and if you can receive the following,

this indicate nginx installation is successuful.

14. install PHP-5.5.4

./konfigurieren \

prefix=/usr/local/php \

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

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

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

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

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

with-jpeg-dir=/usr/local/jpeg8/ \

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

with-mcrypt=/usr/local/libmcrypt/ \

with-zlib-dir=/usr/local/zlib/ \

with-gd=/usr/local/gd2/ \

enable-shmop \

enable-inline-optimization \

enable-soap \

enable-pcntl \

enable-sockets \

machen && make install

 

due to there is no dictionary conf in “/usr/local/php

but the configuration file will be located in “/usr/local/php/conf”,

Damit , I need to generate conf dictionary. and then edit php.ini

mkdir /usr/local/php/conf

cp php.ini-production /usr/local/php/conf/php.ini

 

15.install PDO_MYSQL-1.0.2

./konfigurieren \

prefix=/usr/local/pdo-mysql \

–with-php-config=/usr/local/php/bin/php-config \

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

warningneed re2c-0.13.4

download and install re2c-0.13.5

./konfigurieren

machen && make install

continue to configure PDO_MYSQL-1.0.2

you need to replacemysql.h” zu ” /usr/local/mysql/include/mysql.h

Wie in der folgenden Abbildung gezeigt:

machen && make install

php installation is successful.

 

16.install ImageMagick-6.5.9-10

./konfigurieren \

prefix=/usr/local/imagemagick \

with-modules \

machen && make install

17.安装imagick-3.2.0b2

./konfigurieren \

prefix=/usr/local/imagick \

–with-php-config=/usr/local/php/bin/php-config

machen && make install

18. configure PHP-FPM

cd /usr/local/php/etc/

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

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

You can refer to the following parameter.

192.168.17.55:9000

Nginx

Nginx

64

65536

500

192.168.17.55

before starting php-fpm, you need to edit file php.ini

vim /usr/local/php/conf/php.ini

hinzufügen “cgi.fix_pathinfo=1” und “doc_root=after line 766(;cgi.fix_pathinfo=1 )

 

edit nginx.conf

open php option, changing “/scriptsof php to “/usr/local/nginx/html” oder “$document_root

wie in der folgenden Abbildung gezeigt

speichern und schließen.

create index.php in path …/nginx/html

write the following content

?php

Phpinfo();

?;

speichern und schließen.

execute /usr/local/php/sbin/php-fpm to start php.

restart nginx

access http://192.168.17.55/index.php , you can find php information page.

Damit, the LNMP deployment had been finished.

Hinterlasse eine Antwort